Jump to content

Recommended Posts

Posted (edited)

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.
Posted (edited)

Hi,

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

keep it up!

Edited by Pakku
Posted

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

  • 2 weeks later...
Posted

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.

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
  • Recently Browsing   0 members

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