Change the SAPI Microsoft Speech Object Library Voice with Delphi code

Multi tool use
Multi tool use


Change the SAPI Microsoft Speech Object Library Voice with Delphi code



I'm using the 'Microsoft Speech Object Library' and I would like to change the default voice through delphi code.



My default voice is a woman speaking. How do I change it to someone else if someone else is available?



I'm using SAPI 5.4 and Delphi XE6.





msdn.microsoft.com/en-us/library/ee125652.aspx read the documentation and work with the examples
– David Heffernan
Oct 23 '14 at 21:50





1 Answer
1



You did not say which version of SAPI you are using, or show the code you are using to invoke SAPI with.



For instance, in SAPI 5, the ISpVoice interface has a SetVoice() method, where you pass it a ISpObjectToken interface for a specific voice. To get the ISpObjectToken, you can:


ISpVoice


SetVoice()


ISpObjectToken


ISpObjectToken



use SpEnumTokens() to enumerate available voices until you find one you want.


SpEnumTokens()



use SpFindBestToken() to find a voice that matches various criteria you specify.


SpFindBestToken()



use SpCreateNewToken() or related function if you know the specific voice you want to use.


SpCreateNewToken()





I'm using SAPI 5.4 and I haven't written any code yet, because I do not know how to use those code you gave above. I currently only know how to let it speak the text. Using the SPVoice1.speak()
– Shaun Roselt
Oct 23 '14 at 20:45





SPVoice1.Speak() is code, so obviously you have "written any code". You would simply call SPVoice1.SetVoice() before calling SPVoice1.Speak(). You need to learn how to use the functions I mentioned so you can obtain a token for different voices. If you do not call SPVoice1.SetVoice(), SPVoice1.Speak() uses whatever default voice is configured in the Windows Control Panel.
– Remy Lebeau
Oct 23 '14 at 21:02


SPVoice1.Speak()


SPVoice1.SetVoice()


SPVoice1.Speak()


SPVoice1.SetVoice()


SPVoice1.Speak()






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

0wGCt,qirpx,8ApE
FVlp0eL59CD6zcAure5OyW2KE8A6O,V6LA,R6fZOR2cihWB,lJGLPgb2WXWVYw,lODop4zmVy PjogCWOG,0GW j,I hwfb dnz W

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications