PowerShell: Text to Speech


PowerShell is able to utilize the ‘Text to Speech’ function in the Windows operating system. You can check the voice settings in ‘Control Panel\All Control Panel Items\Speech Recognition’

image

$results = Get-Content C:\results.txt

Add-Type -AssemblyName System.Speech
$synthesizer = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer

# This line converts the text to speech
$synthesizer.Speak($results)

# This line lists the installed voice information
$synthesizer.GetInstalledVoices() | ForEach-Object { $_.VoiceInfo }

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s