Next IVR

IVR, web and mobile programming for contact center technology.

Recording wav files on Windows 7


I wanted to record sound files quickly on Windows 7, to create some wav files for an IVR application.  Unfortunately, there's nothing included in Windows 7 that handles it.  Sure, you can install Windows Media Encoder and the like, but that's cumbersome. And you can record WMA sound files with the windows sound recorder, but then you'll have to use something like FFmpeg to convert it to a wav file. Too much work.

Sox to the rescue!  Using a simple batch script, I put together a string of sox commands to do what I need:

``` {style="padding-left: 30px;"} @ECHO OFF

SET PATH=C:UsersPublicDocumentssox-14.4.0;%PATH%

CLS

ECHO %2

sox -d -r 8000 -c 1 -b 16 "%1.wav" silence 1 0.50 -96d 1 00:03 -96d

sox "%1.wav" temptrimmed.wav silence 1 00:00:01 -96d

sox temptrimmed.wav tempreverse.wav reverse

sox tempreverse.wav temptrimmed.wav silence 1 00:00:01 -96d

sox temptrimmed.wav "%1.wav" reverse

del temptrimmed.wav

del tempreverse.wav

</address>
I saved that in a file named soxrecord.cmd

I created another batch file like so:

``` {style="padding-left: 30px;"}
soxrecord hello "Hello, and thank you for calling."

soxrecord unavailable "Unfortunately, the system is currently unavailable."

soxrecord bye "Good bye!"

I saved that in script.cmd.

I set my headset mic to be the default mic.

Now, when I run script.cmd, I see the text on the screen, and I see sox capturing the mic input.  I speak the phrase and then I hit the mute button on the headset mic (optional).  After 3 seconds, sox stops the recording, trims the beginning and end, and moves on to the next prompt.

That's it!  Nice and easy.  No need for anything else but sox and a couple of batch files.