Jump to content

Speaking Text Into A File


FuryCell
 Share

Recommended Posts

Just a quickly written scrap that can speak text directly into a wav file using COM. Just want to see if there is any interest. If intrest is high maybe I can add some proper error checking and clean the code up a bit. ;)

_SpeakToWAV("hello",@ScriptDir&"\TEST.wav")

Func _SpeakToWAV($sText,$sFile)
    $ObjVoice=ObjCreate("Sapi.SpVoice")
    $ObjFile=ObjCreate("SAPI.SpFileStream.1")
    $objFile.Open($sFile,3)
    $objVoice.AudioOutputStream = $objFile
    $objVoice.Speak ($sText)
EndFunc
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

Hi,

i like the idee! it may for some of us very useful.

keep it up!

Edited by Pakku
Link to comment
Share on other sites

Hi,

i like the idee! it may for some of us very useful.

keep it up!

Arjan

Thanks for the feedback. I will look into a way to implement error checking. ;)

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

Thanks for the feedback. I will look into a way to implement error checking. ;)

Great job. i wanted to do this before but did know exactly. someone should write up a good UDF like IE.au3

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Hey SolidSnake,

i like your func alot. however i would like to know whether there is a possibility to use diffrent languages? i tried german and russian texts .... and it sounded like crap cuz it uses a english dialect. i appreciate your help. greetz,

Zephir

Link to comment
Share on other sites

@All

Thanks for the replies

@Zephir

Not sure. I always thought it would use the OS's default language. Anyone know how to change languages?

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

ok so far so good.

did some research and found this:

http://www.text-reader.com/trspeaker_Engli...eechengines.htm

here u can download the engines for the different languages.

EDIT: Did what you said. and downloaded the German Engine, read through some things in the official SAPI Help File but still cant find out what languagecode to use for german or russian... ?

Edited by Zephir
Link to comment
Share on other sites

  • 2 weeks later...

SAPI5 (like XP)

The default voice is stored in registrykey:

HKCU\Software\Microsoft\Speech\Voices\DefaultTokenId

corresponding to the entries in:

HKLM\SOFTWARE\Microsoft\Speech\Voices\Tokens

To change your favourite language manually execute:

control "%commonprogramfiles%\Microsoft Shared\Speech\sapi.cpl"

Downloadable voices are available only in:

german, french and english

You have to install MS Reader

Improved version:

_SpeakToWAV("Hello this is a test",@ScriptDir&"\TEST.wav")

Func _SpeakToWAV($sText,$sFile)
    $ObjVoice=ObjCreate("Sapi.SpVoice")
    $ObjFile=ObjCreate("SAPI.SpFileStream.1")
    $objFile.Open($sFile,3)
    $objVoice.AudioOutputStream = $objFile
    $objVoice.voice = $objVoice.GetVoices("Language=409").Item(0)
    $objVoice.Speak ($sText)
EndFunc
So you can change 409 only to 407 and 40C

If you want other languages you need commercial 3rd party soft like cepstral

SAPI4

http://www.text-reader.com/trspeaker_Engli...eechengines.htm

here u can download the engines for the different languages.

This is only the addon.

Additonally you need this:

American English

British English

Dutch

French

German

Italian

Japanese

Korean

Portuguese (Brazilian)

Russian

Spanish

and the SAPI4a engine

Both versions can coexist, but don't ask me to use SAPI4 and AutoIt3 under XP ;)

Learn more about SAPI4 with the SDK.

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