Next IVR

Providing innovative contact center solutions and services.

Making quick recordings with Powershell

When I need recordings for an application and I want to make sure my recording script is accurate, I can either record all the voice files in my voice (bleh!) or use the Windows speech engine to generate some quick recordings. I use the opposite gender of the default TTS engine, so I'll definitely notice when a recording is missing and text to speech is kicking in. This Powershell script is for development purposes only!!!

name    script
1.wav   Hello and welcome.
2.wav   Thanks for calling.  Bye!


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

# Set the file format to basic/wav that IVR systems recognize
$format = New-Object System.Speech.AudioFormat.SpeechAudioFormatInfo(

# See which voices are available on your system
$info = $speak.GetInstalledVoices().VoiceInfo

#Set the voice.
$speak.SelectVoice('Microsoft Zira Desktop')
$target = 'C:\Users\public\Documents\to-record\'

$a = Import-Csv -Delimiter "`t"  -Path ($target+'')
$a | foreach {
    $speak.setOutputToWaveFile($target+$, $format); 
    # This writes the sound file

#The last sound file is not released until you dispose the object