Making your Computer talk with PowerShell

text to speech

I’ve been playing around a bit with Microsoft’s built in text to speech capability, and if you haven’t seen it, it really is fun to play with. Windows has had the capability to do text to speech for a while, Windows 7 comes with a female voice named “Anna”, while Windows 8 has the capability to use several different voices (and languages I think).

It is extremely easy to try this out in PowerShell. Simply open Powershell on your computer and type in the following line:

(New-Object –ComObject SAPI.SPVoice).Speak(“This is a test”)

Your computer will immediately speak whatever text is in the parenthesis.

Sometimes the words don’t come out quite right, so you need to do a little bit of phonetic-eze to get them to sound better, like so:

(New-Object -ComObject SAPI.SPVoice).Speak(“Owh Nohs I have been hackered by the North Koreans”)

Or the ever famous:

(New-Object -ComObject SAPI.SPVoice).Speak(“You can’t connect to the inter net? it must be a Chinese a- Pea Tea”)

For more information and how to access the multiple voices in Windows 8, check out this excellent blog article.