Recording Audio Text Files

by Feb 22, 2012

Did you know that PowerShell can record audio messages? All you need is some text. You can then turn the text into spoken language, convert it to a WAV file and play it back or send it to someone. Here’s how:

$Path = "$env:temp\file.wav"

Add-Type -AssemblyName System.Speech

$synthesizer = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
$synthesizer.SetOutputToWaveFile($Path)
$synthesizer.Speak('This is a recording.')
$synthesizer.Speak('Adding more to it')
$synthesizer.SetOutputToDefaultAudioDevice()

# Play back the recorded file
Invoke-Item $Path

Twitter This Tip! ReTweet this Tip!