Jump to content

Speak Text and save to wav


Tukata
 Share

Recommended Posts

_Talk()

@aceloc What are you trying to accomplish with that code? :) It's better to not make a post if you don't understand the topic rather than give people wrong information IMHO.

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Try this:

$strFName = @scriptdir&"\AudioOutputStream.wav"
$Text = "The TTS voice will speak this text into a file."
Const $SSFMCreateForWrite = 3

$objVOICE = ObjCreate("SAPI.SpVoice")
$objFSTRM = ObjCreate("SAPI.SpFileStream")

$objFSTRM.Open($strFName , $SSFMCreateForWrite, False)
$objVOICE.AudioOutputStream = $objFSTRM
$objVOICE.Speak($Text)
$objFSTRM.Close

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

lod3n

You are great !!!

Just when I was giving up, you came to the rescue.

Many many many thanks to you !

BTW, where can I find info about "SAPI.SpFileStream" command ?

Are there any parameters we can add to manipulate the recording ?

Can it be save to MP3 ? (just curious).

Does it works with all OS ?

Are there any limitation on the length of file or size or special characters like < " > ?

Thank you again

Tuk

Edited by Tukata
Link to comment
Share on other sites

I found this information on MSDN by searching for SAPI and .wav, and then I just translated it to AutoIt. I am sure there are more parameters, yes.

No, it cannot be saved to MP3 (that I know of), but you could run the resulting wav through a MP3 encoder afterwards.

This should work on any version of Windows where SAPI is installed. SAPI is available as a download from Microsoft if not, but it comes with Windows XP.

I haven't experimented with the text or file sizes, but I don't think there's a limit on either, other than physical disk space. I am going to post this as a UDF in Scripts and Scraps later, along with a method of saving it as a MP3. I will post a link to it here when I do.

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

lod3n

Thanks for the info.

I am using MMB (MultiMedia Builder) to send the $text as parameter and I know already that the < " > is a problem and should be removed from string.

I am sure many will like this UDF (me for sure).

I thouth about some features:

Speak and save.

Speak only.

Save only.

Convert to MP3

Recording with mic (?)

Capturing playing sound (from another application) !!!!

Good luck and thanks

Tuk

Edited by Tukata
Link to comment
Share on other sites

Well, I will be the first to let you all know that it works wonderfully on Windows® Longhorn® (otherwise know as Vista®). I know I will be able to put this UDF to good use sometime in the near or distant future. Thanks lod3n for the nice UDF contribution.

terrabyte

*EDIT:*

By the way, I will be putting this UDF under some testing. ie: File limitations, file formats, ect.

Edited by terrabyte
Spoiler

 

"...Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like.My crime is that of outsmarting you, something that you will never forgive me for." --The Mentor

"Mess with the best, die like the rest!!" -Hackers

"This above all to thine own self be true." -William Shakespeare

"Corruption is only as corrupted as the individual makes it out to be." -i386

 

style7,AutoIt.png

 

 

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...