Recording high quality voice prompts for Asterisk
Recently I’ve found myself setting up a new Asterisk box, which is oddly one of my favorite tasks. IP Telephony (or VoIP for the rest of us) is quite fun to play with. Office phones and IVRs are something that everyone uses. It’s really nice to see something you have built used day in and day out without anyone ever noticing it. Asterisk doubles this fun because A) You can make the phone system do whatever you can think of (as long as you can program it) and B) You can build a system that rivals the functionality of the BIG corporate systems… if you know what you’re doing.
One of the biggest challenges in setting up a professional grade IVR system is getting good voice recordings. Cell phones have distorted most peoples view of “quality” but you’ll definitely notice a bad voice recording on an even worse cell connection.
For voice prompts, you have two options — Professional or Do-It-Yourself. Many companies offer easy to order recordings, such as Digium and Flowroute. Their prices aren’t bad unless you’ve got a lot to record. The system I’m setting up has a very simple IVR which basically welcomes you, offers to let you dial the party you want, or press zero for the operator. It doesn’t have any departmental menus or any sublevels (no “Press 1 for Sales. Press 2 for Parts. You have pressed 1 for Sales. Please press 1 for Cars. Press 2 for Motorcycles.” etc, etc). My script is 65 words, which should cost between $50 and $100, cheap really.
I prefer the second option, Do-It-Yourself, because it gives me more control. If you’ve got a company of more than 5 people, you can probably find someone with a nice voice. All they need to do is be able to read a script, speak in a nice tone, and enunciate while being recorded. In the early days I used asterisk to record the prompts. It’s not bad but you’re limited by the quality of your phone and the codec you use. Here’s some example code:
exten => 2903,1,Answer()<br /> exten => 2903,n,Wait(2)<br /> exten => 2903,n,Record(./customized/menu.gsm)<br /> exten => 2903,n,Wait(2)<br /> exten => 2903,n,Playback(./customized/menu)<br /> exten => 2903,n,Hangup()
My new preference is to record on my computer and then convert. For hardware I use a Blue Microphones Yeti USB Mic. For recording software I use Audacity. Go into Preference > Quality and set the “Default Sample Size” to 8000 and “Default Sample Format” to 32 bit. Go ahead and record your tracks (in Mono) and do any cleanup/trimming necessary. Then you need to get the file out; go to File > Export. Use “Other uncompressed files” > Options, set “Headers” to WAV and Encoding to “U-law”.
At this point in time you can upload and use the files in your Asterisk install. Make sure to rename the file extension to .ulaw though. In my case, I want the files in g729 since I use flowroute for my DIDs and they support g729. You can convert your files in asterisk using
file convert /full/path/BEFORE.ulaw /full/path/AFTER.g729 (which is so much easier than using sox or similar tools). If you plan on handling any amount of traffic, I highly suggest you transcode all your files in advance to any formats that might be used. It isn’t that huge of a CPU suck to transcode unless you’ve got a busy box and/or you built a lightweight server.