Speech Synthesis

Unless you are running Windows Vista, this example requires you to have .NET 3.0 installed.

import clr clr.AddReference('System.Speech') from System.Speech.Synthesis import SpeechSynthesizer

spk = SpeechSynthesizer spk.Speak('Hello world!')

That was easy! You can discover more about text to speech in the docs on the SpeechSynthesizer.

You can get a list of all the available voices, and change the current voice, with code like: voices = spk.GetSelectedVoices names = [voice.VoiceInfo.Name for voice in voices]

spk.SelectVoice(names[0])
 * 1) Select the first voice in the list

Back to Contents.