Speech Synthesis
From IronPython Cookbook
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] # Select the first voice in the list spk.SelectVoice(names[0])
Back to Contents.

