News:

Welcome to RetroCoders Community

Main Menu

freebasic Psalms Reader App

Started by ron77, Aug 04, 2022, 05:27 AM

Previous topic - Next topic

ron77

hello... here is a very basic Psalms program that prints a chapter from the Psalms book and read it aloud with TTS (only for windows version)

voice.exe TTS Cli file to put inside the project folder: https://www.elifulkerson.com/projects/commandline-text-to-speech.php

plus the Psalms text file attached :) Enjoy...

fb_psalms.bas file:
dim TTSvoice as STRING
TTSvoice = "Microsoft David Desktop"

type chapter
    redim verse(any) as string
End Type

sub sAppend(arr() as string , temp as string)
    redim preserve arr((lbound(arr)) to (ubound(arr) + 1))
    arr(ubound(arr)) = temp
End Sub

sub LoadArrays(filename as string, psalms2() as CHAPTER)
    dim f as long = FREEFILE
    dim fline as STRING
    dim index as long = 1
    dim counter as long = -1
    open filename for input as #f
    while not eof(f)
        line input #f, fline
        var tag = instr(fline, ":")
        var sText = TRIM(MID(fline, tag+1))
        var start = mid(fline, 1, tag)
        if val(start) = index THEN
            counter +=1
            index += 1
            redim preserve psalms2(counter)
        EndIf
        sappend(psalms2(counter).verse(), sText)
    Wend
    
End Sub

dim psalms() as CHAPTER

LoadArrays("psalms.txt", psalms())

dim inpt as STRING

do
    cls
    INPUT "enter psalms chapter (1 - 150): ", inpt
    dim as long chap = val(inpt)-1
    dim praise as string
    for i as long = 0 to ubound(psalms(chap).verse)
        praise += psalms(chap).verse(i) + " "
    Next
    
    print praise
    
    shell("voice -r -1 -n " & Chr(34) & TTSvoice & Chr(34) & " " & Chr(34) & praise & Chr(34))
    
    sleep
    
Loop until inkey = chr(27)


[attach id=13]psalms.txt[/attach] 


sleep

and here is a link to github with a GUI fltk-c TTS App of Psalms reader https://github.com/lonelyStar211/fb_psalms_gui