Menu

eSpeak in QB^$

Help
Luke Smith
2018-07-23
2018-08-21
  • Luke Smith

    Luke Smith - 2018-07-23

    This eSpeak sample program runs on Win 10 QB64 but there is no sound. The Task Master shows that eSpeak is opened.

    DECLARE LIBRARY
    FUNCTION WinExec (lpCmdLine AS STRING, BYVAL nCmdShow AS LONG)
    END DECLARE
    DECLARE SUB eSpeak (lines$)
    DIM SHARED eSpeak_exe$

    eSpeak_exe$ = " espeak.exe -v en-us+f2 -p60 -g5 -k20 "
    A$ = "Hello How are you"
    eSpeak A$

    A$ = "Goodbye"
    eSpeak A$
    END

    SUB eSpeak (lines$)
    Filename$ = eSpeak_exe$ + CHR$(34) + lines$ + CHR$(34) + CHR$(13)
    x = WinExec(Filename$ + CHR$(0), 0)

    PRINT "Filename = ", Filename$ ' Debug Line
    PRINT "lines$= ", lines$ ' Debug Line
    PRINT CHR$(13)
    

    END SUB
    Output:
    Filename = espeak.exe –v en-us+f2 –p60 *g5 –k20 “Hello How are you”
    Ilines$= Hello How are you

    etc. for Goodbye

    However when this line is entered directiy into the Windows command line :

    espeak.exe –v en-us+f2 –p60 *g5 –k20 “Hello How are you”

    You get the expected speech output

    How do I get eSpeak to run from QB64?

     
  • Luke Smith

    Luke Smith - 2018-08-21

    When you want eSpeak to speak from a Win10 QB64 program I use the following line:
    SHELL _HIDE "eSpeak -v en-us This_is_What_U_Want_to_Say"

    You don't need to DECLARE LIBRARY or DIM anything just include your variation of the above line as a QB64 line.

     

Log in to post a comment.