Using SAPI 5 to Convert Text to WAV file

Here is AutoIt Script sample script:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=tango-icon-theme-0.8.1\16x16\actions\media-record.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;    http://tango.freedesktop.org/Icon_Metaphors
Dim $i
Func ConvertTextToWAV(
$asFN)
    Dim $text, $oSPV,
$oSPSTRM, $WAV
   
$oSPV = ObjCreate('SAPI.SpVoice')
   
$oSPSTRM = ObjCreate('SAPI.SpFileStream')
   
$text = FileRead($asFN)
   
$WAV = StringReplace($asFN, '.txt', '.wav')
    If FileExists
($WAV) Then FileDelete($WAV)
   
$oSPSTRM.Open($WAV, 3, False)
   
$oSPV.AudioOutputStream = $oSPSTRM
   
$oSPV.Speak($text)
    $oSPSTRM.Close
EndFunc   ;==>TextToWAV
For $i = 1 To
$cmdline[0]
    ConvertTextToWAV
($cmdline[$i])
Next


NOTE: To use drag .txt files atop  
compiled version of the script

No comments:

Favorite Tweets