GaryFrost Posted June 24, 2005 Posted June 24, 2005 (edited) 1st. found only had Microsoft Sam installedAfter some research finally have 4 voices installedCan retrieve which voices are installed, but to can't figure out how to change the voice for the speak function without writing to a file using WScriptAny Help would be greatly appreciatedHere's the short code to get the voices and the resultsDim $voic = ObjCreate("SAPI.SpVoice") Dim $SOTokens = $Voic.GetVoices('', '') For $Token In $SOTokens ConsoleWrite($Token.GetDescription & @LF) Next $voic = "">Running: (3.1.1.51):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Documents and Settings\Gary\My Documents\test4.au3" Microsoft MaryMicrosoft MikeMicrosoft SamSample TTS Voice>AutoIT3.exe ended.>Exit code: 0 Time: 1.265Gary Edited June 24, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
/dev/null Posted June 24, 2005 Posted June 24, 2005 1st. found only had Microsoft Sam installedAfter some research finally have 4 voices installedCan retrieve which voices are installed, but to can't figure out how to change the voice for the speak function without writing to a file using WScriptyou should be able to set the voice with this command: $voic.voice = $voic.Getvoices("","").item(0)However, on my system this throws a COM error ("member not found"), although I believe that the syntax is O.K. (see SAPI help file)CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
GaryFrost Posted June 24, 2005 Author Posted June 24, 2005 Had already tried thatexpandcollapse popup_TalkOBJ('This is auto it beta speaking.', 1) ;voice params: ; ;1 - Microsoft Mary ;2 - Microsoft Mike ;3 - Microsoft Sam ;4 - Sample TTS Voice Func _TalkOBJ($s_text, $s_voice = 3) Local $o_speech = ObjCreate ("SAPI.SpVoice") Local $i = 0, $voice Dim $SOTokens = $o_speech.GetVoices('', '') For $voice In $SOTokens ConsoleWrite($s_voice & ", " & $i & @LF) Select Case $s_voice == 1 And $i == 0 ConsoleWrite($voice.GetDescription & @LF) $o_speech.Voice = $o_speech.GetVoices("","").Item(0) ;~ $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0) $o_speech.Speak ($s_text) ExitLoop Case $s_voice == 2 And $i == 1 ConsoleWrite($voice.GetDescription & @LF) $o_speech.Voice = $o_speech.GetVoices("","").Item(1) ;~ $o_speech.Voice = $voice.GetVoices("Name=Microsoft Mary", "Language=409").Item(0) $o_speech.Speak ($s_text) ExitLoop Case $s_voice == 3 And $i == 2 ConsoleWrite($voice.GetDescription & @LF) $o_speech.Voice = $o_speech.GetVoices("","").Item(2) ;~ $o_speech.Voice = $voice.GetVoices("Name=Microsoft Mike", "Language=409").Item(0) $o_speech.Speak ($s_text) ExitLoop Case $s_voice == 4 And $i == 3 ConsoleWrite($voice.GetDescription & @LF) $o_speech.Voice = $o_speech.GetVoices("","").Item(3) ;~ $o_speech.Voice = $voice.GetVoices("Name=Sample TTS Voice", "Language=409").Item(0) $o_speech.Speak ($s_text) ExitLoop EndSelect $i = $i + 1 Next $o_speech = "" EndFunc ;==>_TalkOBJThrows an error>Running: (3.1.1.51):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Documents and Settings\Gary\My Documents\test4.au3" 1, 0Microsoft MaryC:\Documents and Settings\Gary\My Documents\test4.au3 (27) : ==> The requested action with this object has failed.: $o_speech.Voice = $o_speech.GetVoices("","").item(0) $o_speech.Voice = $o_speech.GetVoices("","").item(0)^ ERROR SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
/dev/null Posted June 24, 2005 Posted June 24, 2005 Throws an errorYup, same on my system. If you catch the the COM error, you will get the error message I mentioned in my first post ("member not found"). Whatever that means...$oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler ; Performing a deliberate failure here (object does not exist) $fault1=$ColProcessors.item(1) Exit ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) SetError(1); something to check for when this function returns EndfuncCheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
GaryFrost Posted June 25, 2005 Author Posted June 25, 2005 This now works with latest beta 3.1.1.53 $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler _TalkOBJ('This is auto it beta speaking.', 1) _TalkOBJ('This is auto it beta speaking.', 2) _TalkOBJ('This is auto it beta speaking.', 3) ;voice params: ; ;1 - Microsoft Mary ;1 - Microsoft Sam ;3 - Microsoft Mike Func _TalkOBJ($s_text, $s_voice = 3) Local $o_speech = ObjCreate ("SAPI.SpVoice") Select Case $s_voice == 1 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mary", "Language=409").Item(0) Case $s_voice == 2 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0) Case $s_voice == 3 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0) EndSelect $o_speech.Speak ($s_text) $o_speech = "" EndFunc ;==>_TalkOBJ ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) SetError(1); something to check for when this function returns Endfunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
w0uter Posted June 25, 2005 Posted June 25, 2005 sweet. i made this: Local $o_speech = ObjCreate ("SAPI.SpVoice") For $i = 0 To $o_speech.GetVoices().Count() - 1 $voice = $o_speech.GetVoices().Item($i) $o_speech.Voice = $voice $o_speech.Speak ('I am a ' & $voice.GetAttribute("Gender") & ' and my name is ' & $voice.GetAttribute("Name") & '. <rate speed="6">I can talk really fast</rate> <rate speed="-9">but also very slowly</rate>. By the way, i <pitch middle="50">can also talk high</pitch> <pitch middle="-50">and talk low.</pitch> Cool.', 8) Next My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
Valuater Posted June 26, 2005 Posted June 26, 2005 (edited) This now works with latest beta 3.1.1.53<{POST_SNAPBACK}>********** As ALWAYS, Your timing is ImpecableIf $Vc = "on" Then $a=GUIGetCursorInfo() If $a[4] = $Icon_1 then $o_speech.Speak ("1",8) If $a[4] = $Icon_2 then $o_speech.Speak ("2",8)..............and so onI was looking for a way to do this... and low and behold along comes gafrost AGAIN!!!!.. and wOuterthx??Still don't have the fix for the curve cut-out on the last pic/shape??thx8) Edited June 26, 2005 by Valuater
thefluxster Posted February 21, 2006 Posted February 21, 2006 This now works with latest beta 3.1.1.53 $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"); Install a custom error handler _TalkOBJ('This is auto it beta speaking.', 1) _TalkOBJ('This is auto it beta speaking.', 2) _TalkOBJ('This is auto it beta speaking.', 3) ;voice params: ; ;1 - Microsoft Mary ;1 - Microsoft Sam ;3 - Microsoft Mike Func _TalkOBJ($s_text, $s_voice = 3) Local $o_speech = ObjCreate ("SAPI.SpVoice") Select Case $s_voice == 1 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mary", "Language=409").Item(0) Case $s_voice == 2 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Mike", "Language=409").Item(0) Case $s_voice == 3 $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0) EndSelect $o_speech.Speak ($s_text) $o_speech = "" EndFunc ;==>_TalkOBJ ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription ) SetError(1); something to check for when this function returns Endfunc Latest Beta (3.1.1.108) doesn't seem to work with this code. I get COM errors: We intercepted a COM Error ! Number is: 80020005 Windescription is: Type mismatch “Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker
GaryFrost Posted February 22, 2006 Author Posted February 22, 2006 Latest Beta (3.1.1.108) doesn't seem to work with this code. I get COM errors: Works with 3.1.1.109 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
thefluxster Posted February 22, 2006 Posted February 22, 2006 (edited) Works with 3.1.1.109Can't keep up with these guys! I just installed a couple of days ago! :">Spoke too soon... same problem with 3.1.1.109 and 3.1.1.110 Any ideas? Edited February 22, 2006 by thefluxster “Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker
Valuater Posted February 22, 2006 Posted February 22, 2006 change all of these to 3... because you do not have other voices installed_TalkOBJ('This is auto it beta speaking.', 3)_TalkOBJ('This is auto it beta speaking.', 3)_TalkOBJ('This is auto it beta speaking.', 3)8)
thefluxster Posted February 22, 2006 Posted February 22, 2006 change all of these to 3... because you do not have other voices installed_TalkOBJ('This is auto it beta speaking.', 3)_TalkOBJ('This is auto it beta speaking.', 3)_TalkOBJ('This is auto it beta speaking.', 3)8)I'll check on that and get back to you. “Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker
Valuater Posted February 22, 2006 Posted February 22, 2006 I'll check on that and get back to you.Glad i didn't hold my breath8)
GaryFrost Posted February 22, 2006 Author Posted February 22, 2006 Glad i didn't hold my breath8) Good thing, would of had to call 911 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Oxin8 Posted February 22, 2006 Posted February 22, 2006 although it looks like you figured it out, i just wanted to make note that the Sample TTS Voice is for just that. It can read it's one sample line and that's it. Else it just goes "BLAH BLAH BLAH BLAH". Kinda funny when i figured that one out.... ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
thefluxster Posted February 22, 2006 Posted February 22, 2006 Sorry I didn't reply sooner - left work and forgot about it when I got home. Yes, it is because I don't have all the voices installed. It worked fine on my friends computer. Thanks a million. BTW, for anyone interested, "Microsoft Anna" is probably the best voice emulation you can use for this. If you slow it down just a bit, it actually sounds like a real person and does a better job pronouncing odd bits. My two cents. “Efficiency is doing things right; effectiveness is doing the right things.”-Peter F. Drucker
Valuater Posted February 22, 2006 Posted February 22, 2006 Sorry I didn't reply sooner - left work and forgot about it when I got home. Yes, it is because I don't have all the voices installed. It worked fine on my friends computer. Thanks a million. BTW, for anyone interested, "Microsoft Anna" is probably the best voice emulation you can use for this. If you slow it down just a bit, it actually sounds like a real person and does a better job pronouncing odd bits.My two cents.I understand Microsoft Anna is for Windows Vista... Can we get it for Windows Xp??8)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now