Point at which speaking is stopped?

Jim Hurley jhurley0305 at sbcglobal.net
Mon Dec 26 18:41:48 EST 2011


Mike,

Ingenious. Works like a charm. Thank you.

There will be problems, as I have discovered in an other app I am working on in parsing sentences. The period has multiple uses besides a sentence delimiter, for example in abbreviations and in decimal numbers. These can be parsed out however.

Thanks again, vert nice,

Jim Hurley


I have put my Text to Speech app up on the web:

go url "http://jamesphurley.com/TextToSpeech.livecode"




> 
> 
> Mike Bonner wrote:
> 
> Yep, in simplest form its not to bad.  I put a bunch of text into a field
> then to read it, set the itemdelimter to "."  put the field text into a
> variable and replaced "? " with ?. " same with "! " replaced with "!. " (to
> ensure we still retain punctuation tone changes)
> 
> So the following script placed in a button will read from field 1. Clicking
> the button again pauses, Reading picks up where it left off.
> 
> local tReading, tCurrLine, tTotalLines,tText
> on mouseUp
>    if tReading is empty then put false into tReading
>    put not tReading into tReading
>    set the label of me to "Reading: " & tReading
>    startLooping
> end mouseUp
> 
> command startLooping
>    set the linedelimiter to "."
>    if tReading then
>       if tCurrLine is empty then
>          put field 1 into tText
>          replace "? " with "?. " in tText
>          replace "! " with "!. " in tText
>          put the number of lines in tText into tTotalLines
>          put 1 into tCurrLine
>       end if
> 
>       if not revIsSpeaking() then
>          revspeak line tCurrLine of tText
>          if tCurrLine = tTotalLines then
>             put false into tReading
>             put empty into tCurrLine
>          else
>             add 1 to tCurrLine
>          end if
>       end if
>       set the label of me to "Reading: " & tReading
>       send startLooping to me in 20 milliseconds
>    end if
> end startLooping




More information about the use-livecode mailing list