Recording and converting audio files for Asterisk
If you manage Asterisk, sooner or later someone will ask you “Can we have a custom voice prompts and a IVR?”. And if you’re the kind of person that keep up with the latest advances in technology, your office would probably have HD Voice devices. So here is a guide how to record, cut and convert the required audio files in the most common formats circa 2017.
Asterisk comes with quite an extensive library of voice prompts, available in most formats and variety of languages. But if you need to make custom prompts for specific needs or IVR or even a missing language, this it the quickest procedure I came up with to do that.
The first thing you need to decide is what voice are you going to use. You would probably use someone with nice diction from your company, but there a very nice TTS services that are really lifelike. The ones I found in English are:
- Ivona with the voices of Amy UK, Brian UK and Salli US (unavailable as of January 16th)
- Acapela Group with the voices of Ryan USA, Sharon USA, Laura USA and Will USA
- Oddcast with the voices of Hugh UK, Allison USA, Bridget UK and Daniel UK
- iSpeech with the voice of UK Female
- ReadSpeaker with the voice of UK Male
- ResponsiveVoice with the voice of UK female (the sound is somewhat low quality though)
They all had some quirks and problems pronouncing certain phonemes but overall they sound almost indistinguishable from normal human more than 95% of the time. Make sure that they pronounce any specific person or company names correctly. Try using capitalization or even all-caps to force them use different pronunciation. This was the biggest problem I had with them while searching for the best one.
Once you select the person/service that is going to verbalize your text, you need to record it. The easiest way I found is with Audacity.
Set the Project Rate to 16000 Hz and Mono, and you can start recording your phrases. Make sure you leave enough silence between each separate phrase.After you finish recording, you need to mark each section for the export. Pressing Ctrl+B will insert new label set to your current selection. Name it like the desired file for Asterisk.
Select File -> Export Multiple… and for format choose Other uncompressed files then in the Options field select Raw (header-less) and Signed 16-bit PCM. Make sure Split files based on Labels is selected and for names use Labels/Tracks.Rename the extensions of the exported files to sln16. These can be used as a base files for transcoding by Asterisk if you do not have native formats ready. If you want you can repeat the export procedure and just select different Encoding for U-law and A-law. For G.722 you will need to use Custom FFmpeg Export in the Format dropdown. This will prompt you to download the required plugins for Audacity as explained on their site. Place the extracted files in the plugins directory and then continue by selecting Open custom FFmpeg format options. Find and select g722 on both lists and leave everything else as defaults:Change the extension of the resulted files to .g722.
Now you should be able to upload everything to your /var/lib/asterisk/sounds/ folder and create your IVR menu.