Sign in to follow this  
Followers 0
XY16

Speech UDF

4 posts in this topic

hi guys, check out this little udf. it's not much, but at least it's not just sapi.

;speech udf

;uses either sapi or google speech.

;function

;name: _SpeechGet

;description: generates speech and outputs it to the speakers.

;usage: _SpeechGet($Text, $Engine)

;$Text = the text to speak.

;$Engine = the speech engine to use, 0 = microsoft speech API 5x, 1 = Google translation API. 0 is default.

;returns 0 if no errors, 1 for errors.

Func _SpeechGet($Text, $Mode = "0")

if $Text = "" then Return 1

if $Mode > 1 or $Mode < 0 then Return 1

if $Mode = "0" then

;create speech object

Local $Voice = ObjCreate("Sapi.SpVoice")

if not IsObj($Voice) then Return 1

EndIf

if $Mode = "0" then

;speak the text

$Voice.Speak($Text)

Return 0

else

;use the google translation api to get the speech

InetGet("http://translate.google.com/translate_tts?q=" & $Text, @TempDir & "\tempspeech.mp3", 1)

;play the downloaded speech

SoundPlay(@TempDir & "\tempspeech.mp3", 1)

;delete the temporary file

FileDelete(@TempDir & "\tempspeech.mp3")

Return 0

EndIf

EndFunc

let me know if you enjoy it, or if you know of any other web based speech services i could add support for.

1 person likes this

Please note: If you plan on submitting any code snippits to my posts, please refrain from using the code tags as i use a screen reader and can't read the code properly, let alone copy it the way it should be.Thanks for your understanding.Best regardsXY16

Share this post


Link to post
Share on other sites



Tks friend, but you should fix when get other language sound

Share this post


Link to post
Share on other sites

kid1232 please do not resurrect old threads, especially when not adding anything benefiicial. If you had bothered to look you would see that the OP has not been active on the forum in two years.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Tks friend, but you should fix when get other language sound

 

>This is a perfect example.


[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Share this post


Link to post
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
Sign in to follow this  
Followers 0