Multi-Language Voice Output

by Nov 13, 2017

On Windows 10, the operating system ships with a bunch of high-quality text-to-speech engines and is no longer limited to just the English language. The number of available TTS Engines depends on the languages you installed.

PowerShell can send text to these TTS Engines, and via tags can also control the language used. If you have both the English and German TTS Engines installed, you could mix languages like below:

$text = "<LANG LANGID=""409"">Your system will restart now!</LANG>
<LANG LANGID=""407""><PITCH MIDDLE = '2'>Oh nein, das geht nicht!</PITCH></LANG>
<LANG LANGID=""409"">I don't care baby</LANG>
<LANG LANGID=""407"">Ich rufe meinen Prinz! Herbert! Tu was!</LANG>
"

$speaker = New-Object -ComObject Sapi.SpVoice
$speaker.Rate = 0
$speaker.Speak($text)

If you want to use different languages, simply adjust the LANGID number to the culture you would like to use.

Twitter This Tip! ReTweet this Tip!