| 1 |
rawplayer is a simple C applet to stream raw music files in place of mpg123 |
| 2 |
|
| 3 |
INSTALL |
| 4 |
|
| 5 |
compile the .c file and install: |
| 6 |
gcc -O2 rawplayer.c -o /usr/bin/rawplayer |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
Converting MP3 to RAW |
| 11 |
|
| 12 |
Make track01.mp3 into track01.raw with sox (if compiled with mp3 support). |
| 13 |
sox -c 1 track01.mp3 -t raw -r 8000 -c 1 -s -w track01.raw |
| 14 |
|
| 15 |
Otherwise, use whatever app to turn track01.mp3 into track01.wav then use sox on the wav. |
| 16 |
sox -c 1 track01.wav -t raw -r 8000 -c 1 -s -w track01.raw |
| 17 |
|
| 18 |
|
| 19 |
Once you have the raw files put them in any dir on your system (eg /var/lib/asterisk/holdmusic_raw). |
| 20 |
and set up a class in musiconhold.conf like so: |
| 21 |
|
| 22 |
[classes] |
| 23 |
default => custom:/var/lib/asterisk/holdmusic_raw,/usr/bin/rawplayer |
| 24 |
|
| 25 |
|
| 26 |
This is the most efficient way to implement moh because no cpu usage is required to |
| 27 |
explode the very compressed mp3 data then downsample the music to the 8khz mono on the fly |
| 28 |
instead the data is already stored on the disk in the format that asterisk needs it to be |
| 29 |
and the player does little more than pick up frames from the file and hand them to right |
| 30 |
to the asterisk pipe where the audio is shared into all the channels who require it. |
| 31 |
|
| 32 |
|
| 33 |
If you have cpu to spare and want a simple mp3 solution consider the format_mp3 from |
| 34 |
asterisk-addons and the files based moh. |