|
Page 1 of 2 VoIPowering Your Office with Asterisk: Soothing the Savages with Hold Music One of the more fun aspects of running an Asterisk server is choosing your own hold music. Hopefully your callers are not sitting on hold for long periods of time, but as long as they are it's nice to give them something pleas
Linux comes with all the tools you need to record sound files and convert them to the Asterisk-friendly .gsm format. Audacity is an excellent sound recorder and editor that runs on Linux, Macintosh, and Windows. As fun as it is, we're not getting into sound recording today, though, just managing existing sound files. Asterisk versions 1.2 and later includes their own music player, so you can ignore all the documentation that tells you how to add one. Asterisk can handle several different sound file formats on its own, but decoding and encoding sound files eats up CPU cycles, so it's more efficient to convert them yourself. Converting sound files with lame sox Using both sox and lame gives you the ability to convert just about any sound file format. sox does not directly support .gsm or .mp3, two common formats used in Asterisk. If you do not have these already installed, install them with this command on CentOS or Fedora Linux: # yum install lame sox You might need to fetch lame from RPMforge.net. Spoken-word sound files can be converted to the more efficient .gsm format. To convert an .mp3 file use these commands, substituting your own filename: $ lame --decode soundfile1.mp3 soundfile1.wav $ sox -V soundfile1.wav -r 8000 -c 1 soundfile1.gsm resample -ql The easy way to convert a batch of .mp3 files is to place them all in a single directory, then run these commands exactly as shown: $ for i in *.mp3; do lame --decode $i `basename $i .mp3`.wav; done $ for i in *.wav; do sox $i -r 8000 -c 1 $(basename $i .wav).gsm resample -ql; done If your files are already in .wav format, just use the sox commands. .mp3 music files should be converted to raw format for efficiency: $ lame --decode musicfile.mp3 musicfile.wav $ sox -V musicfile.wav -r 8000 -c 1 -w musicfile.raw Use these commands as shown for batch conversions: $ for i in *.mp3; do lame --decode $i `basename $i .mp3`.wav; done $ for i in *.wav; do echo $i; sox $i -r 8000 -c 1 -w ${i%%.wav}.raw ; echo ${i%%.wav}.raw; done
|