Speech-Week: Using a Speech Synthesizer

When you add the assembly “System.Speech” to PowerShell, there is a new type called “SpeechSynthesizer” which can be used to convert text to speech:

Add-Type -AssemblyName System.Speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.Speak('Hello I am PowerShell!')

Note that the speech synthesizer uses the default voice installed with your system. Your synthesizer may not speak “English” by default. We’ll look at how to use different voices in one of the upcoming tips.

Twitter This Tip! ReTweet this Tip!