Jump to content

No-nonsenseTTS (Text to Speech)


R.L.
 Share

Recommended Posts

Using this little 3rd party freeware commandline test to speech tool called TimeTeller (only 11kb, freeware, freely distributable for non commercial purpose):

http://www.kokpeter.dds.nl/Download/index.htm#TimeTeller

(you need to have vb and MS TTS engine to run it, XP has both by default but not 9x)

I made a script to quickly read the text you highligted. With this script, you PC will speak whatever you highlighted immediately with a keypress to the <PrintScreen> button (it will also send the text to the clipboard). And if you want it to stop reading, just press the <Printscreen> button again. To quit the script, just press <f2>.

To run the script, put TimeTeller as TT.exe in the same directory as your script; or you can download the whole thing here and upzip it

NonosenseTTS.zip(107kb)

:huh2:

$G_SZVERSION = "ClipSpeak"

If WinExists($G_SZVERSION) Then 
   Exit
EndIf
AutoItWinSetTitle($G_SZVERSION)

Global $TOREAD 

Global $COMMAND = "TT.exe now"
ToolTip("Press <Printscreen> to toggle start and stop speaking, <f2> to quit.", 10, 0)
Sleep(2000)
ClipPut("Please highlight some text and press the prinnd  screen button.")
Call("speakclip")

HotKeySet("{printscreen}", "toggle")
HotKeySet("{f2}", "quit")


While 1
   sleep (500)
Wend

Func toggle()
   
   $PROCESS = ProcessExists("tt.exe")
   Select
      Case $PROCESS Not = 0
         Call("stopspeak")  
      Case $PROCESS = 0 
         Call("clipplace")
   EndSelect
EndFunc  ;==>toggle


Func clipplace()
   BlockInput(1)
   Send("{CTRLDOWN}{c}{CTRLup}")
   BlockInput(0)
   $LENGTH = ClipGet()
   If StringLen($LENGTH) > 1 Then Call("speakclip")
EndFunc  ;==>clipplace

Func speakclip()
   ToolTip("Press <Printscreen> to toggle start and stop speaking, <f2> to quit.", 10, 0)
   $TOREAD = ClipGet()
   $TOREA0 = StringReplace($TOREAD, "<", "", 0, 1)
   $TOREAD0 = StringReplace($TOREA0, ">", "", 0, 1)
   $TOREAD1 = StringReplace($TOREAD0, '"', "", 0, 1)
   $TOREAD2 = ' " ' & $TOREAD1 & ' " '
   Run($COMMAND & $TOREAD2)
   Sleep(4000)
   ToolTip("", 0, 0)
   
   
EndFunc  ;==>speakclip

Func stopspeak()
   ToolTip("Not speaking", 10, 0)
   ProcessClose("tt.exe")
   $STATUS = "notset"
   Sleep(4000)
   ToolTip("Press <Printscreen> to toggle start and stop speaking, <f2> to quit.", 10, 0)
   Sleep(2000)
   ToolTip("", 0, 0)
EndFunc  ;==>stopspeak

Func quit()
   ProcessClose("tt.exe")
   Exit
EndFunc  ;==>quit

I use it to speak my text when my eyes are tired :D

Edited by R.L.
Link to comment
Share on other sites

ok, that was fun. have it read this:

<>

for some reason, it reads the date and time when it gets to "<>" then continues on. oh well, why would i really want to playback code with this thing anyways? nifty toy.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Just one small note in your code. For your infinate while loop, you should put a small pause in there so that you don't end up using all avaiable CPU cycles doing nothing.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

you mean, like how it's using 98% of my CPU right now... vs another script with just a sleep 250 in it that's not burning any cpu? ouch.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Do you mean using the "sleep" function like this?

While 1
  sleep (100)
Wend

Or it should be done differently?

that's exactly it, though on mine I made it 500, since it's just there to hold the app open, it doesn't need to be as fast as every 100...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

yeah, I didn't actually notice that it was sucking 95-98% cpu till pekster posted about it... guess it was early enough I wasn't using my computer much

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

that's exactly it, though on mine I made it 500, since it's just there to hold the app open, it doesn't need to be as fast as every 100...

Even a 10 milisecond sleep will save the CPU from a good part of it's load. If you know you don't need to detect anything more than half a second, set it at 500 or higher as required. But some amount in there will prevent it from stealing all the time when the token comes around.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

ok, that was fun.  have it read this:  for some reason, it reads the date and time when it gets to "<>" then continues on. 

hmm...this one fixed now,too :ph34r: ...wonder what other characters would be in the group...

from this

$TOREAD = ClipGet()
  $TOREAD1 = StringReplace($TOREAD, '"', "", 0, 1)
  $TOREAD2 = ' " ' & $TOREAD1 & ' " '
'

to this

$TOREAD = ClipGet()
   $TOREA0 = StringReplace($TOREAD, "<", "", 0, 1)
   $TOREAD0 = StringReplace($TOREA0, ">", "", 0, 1)
   $TOREAD1 = StringReplace($TOREAD0, '"', "", 0, 1)
   $TOREAD2 = ' " ' & $TOREAD1 & ' " '

I didn't actually notice that it was sucking 95-98% cpu till pekster posted about it... guess it was early enough I wasn't using my computer much

I remember my TclockEX (displays date in sysclock) used to also show CPU usage in my 98, but no more after upgraded to XP. It was handy.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...