Dynamically Switch Between Different TTS Voices or Languages

⌘K
  1. Home
  2. Programmable Voice
  3. Text to Speech (TTS)
  4. Dynamically Switch Between Different TTS Voices or Languages

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.
 

Code Examples for Switching Between Voices

 
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)");
Was this article helpful to you? No Yes 17

How can we help?