Home‎ > ‎

Text To Speech

Text To Speech (revSpeak command)
How would you like to have your program talk?
  • You could have it talk to your user with  "Good Job", "Try again" and other phrases that you create
  • You could have it say whatever your user types into a field on the screen
  • You could use it to teach the sounds of vowels, consonants and even words
The simplest way is just program the words in the command

    on mouseUp
        revSpeak "Hello, How are you?"
    end mouseUp

    (try it- drag over a button and put the above script in its "mouseUp" command, or just type it in the MessageBox)

You could create variables with the phrases and use them when needed:
    
    put "Good Job" into goodJob
    put "Try again" into tryAgain

    if intersect (button "redbox", button "red") then
        revSpeak goodJob
    else
        revSpeak tryAgain
    end if

You could create a field called "myWords" and allow the user to type anything that they want into it. Then when they press your "Speak" button:

    on mouseUp
        revSpeak field "myWords
    end mouseUp

Notes:
    You can change the sound of the voice, the pitch and the speed of the voice for different effects. (see revSpeak in the Dictionary for more information.
    You have to be careful, not all computers have text-To-Speech capability

For more explanation and error handling code see the LiveCode Lesson "Speaking an Alert Message"

Comments