Hack25.Mix the Perfect Announcement


Hack 25. Mix the Perfect Announcement

Put SoX to work mixing different sound filesmusic, spoken wordsto make the ultimate announcement message.

Are you looking for an easy way to make a seriously cool announcement for your Skype answering machine or outgoing voicemail greeting on your Asterisk VoIP server? You could buy a copy of a high-end audio package like Logic Express for all its cool sound-mixing and effects abilities. Even some of the simpler sound editing tools let you merge files, but (if you have Unix) chances are good that you've already got SoX! If you're on a Mac or Windows box, you're only a download away from having it, so take the MacGyver approach and save some cash. (Mac, Windows, and Linux users can get SoX from http://sox.sourceforge.net/.)

In this little project, we'll mix an announcement message with some background music, and then trim the resulting file to just the right length, all using the SoX toolset. Finally, we'll save it in the appropriate sound format.

To get started, find a piece of music that you think will make good background musicpreferably something that has no lyrics to interfere with the spoken message you'll be mixing in. The music can be in any format SoX can handle.wav, .mp3, whatever. If you can, note the length (in minutes and seconds) of the music file, as this could come in handy later. To figure out the length, just launch the file in your favorite sound player. It should show you the length.

If you use copyrighted music for commercial or nonprivate use, you'll need permission from the artist who created the music, or you'll have to pay royalties for using the music!


Next, record your announcement using Windows Sound Recorder, Cacophony, or your favorite sound recorder. Drop the resulting file in the same folder with your music file. Ohand you might want to note its length, too. Use these two commands to perform some conversions on your raw audio files:

 $ sox  bg_music.mp3  r 14400 c 1  bg_music.wav  $ sox  announce.wav  r 14400 c 1  announce.wav  

These two commands grab the files, resample them both to 14,400 kHz, and make them mono (-c 1), not stereo sounds, ready to be mixed together. The following command mixes the two resultant files into a single file:

 $ soxmix  bg_music.wav announce.wav mixed.wav  

If you find that the background music is too loud or soft, you can adjust it and remix the files:

 $ sox  bg_music.wav  v -0.25  bg_music_quiet.wav  $ soxmix  bg_music_quiet.wav announce.wav mixed.wav  

Then, all that's left is to get the file into the format you need for your telephony application. If it's for an Asterisk announcement, you'll probably want it in GSM format at 8,000 kHz:

 $ sox  mixed.wav  r 8000  mixed_for_asterisk.gsm  

Converting to other formats as opposed to GSM is as simple as changing the extension on your final filename.




VoIP Hacks
VoIP Hacks: Tips & Tools for Internet Telephony
ISBN: 0596101333
EAN: 2147483647
Year: 2005
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net