How do I dynamically switch between different TTS voices or languages?
Installing Multiple Voices
Use this link to install multiple TTS voices with Voice Elements: How do I test Speech Recognition with Voice Elements?
Running through that tutorial will install a default voice. Or, you can manually install the Speech Platform and set the default voice by changing this setting in the VoiceElementsServer.exe.config:
<setting name="TtsDefaultVoice" serializeAs="String"> <value>Microsoft Server Speech Text to Speech Voice (es-MX, Hilda)</value> </setting>
You can only have one default voice. So when you call VoiceResource.PlayTTS("Test"), it will use the default voice.
Switching between different voices dynamically
If you use the overload functions to the TTS commands, you can dynamically switch between the two.
Here's an example: This would play it using the English voice "Zira":
VoiceResource.PlayTTS("Hello. This is a free voice that you can use with Voice Elements.", "Microsoft Server Speech Text to Speech Voice (en-US, ZiraPro)");
This would play it using the Spanish Voice "Hilda":
VoiceResource.PlayTTS("Hola! Esta es una voz gratis que se puede usar con Voice Elements.", "Microsoft Server Speech Text to Speech Voice (es-MX, Hilda)");