2

In our application we allow user to upload audio file. currently we support .wav format and we use "sox" to convert the .wav file to gsm for asterisk. We would like to have mp3 support as well. Any recommendation on how to get this done ?

Your help is highly appreciated. Thanks you.

channa ly
  • 9,479
  • 14
  • 53
  • 86

4 Answers4

1

Surely you can still use sox to convert mp3 to gsm/sln/alaw/ulaw format files

Look at http://sox.sourceforge.net/soxformat.html for more info on formats sox support

number5
  • 15,913
  • 3
  • 54
  • 51
  • It seems like my sox does not support mp3. do I miss something ? – channa ly Sep 07 '12 at 03:32
  • 1
    they do support mp3, on ubuntu/debian try to `sudo apt-get install libsox-fmt-mp3` or just install libsox-fmt-all – number5 Sep 07 '12 at 04:22
  • I have sox support for mp3. But I had some warning output with the following command : sox infile.mp3 -r 8000 -c1 outfile.gsm sox WARN rate: rate clipped 6 samples; decrease volume? sox WARN dither: dither clipped 6 samples; decrease volume? – channa ly Sep 11 '12 at 09:13
  • see here http://stackoverflow.com/questions/6882125/reducing-removing-clipping-in-sox-when-converting-the-sample-rate – number5 Sep 11 '12 at 09:17
1

Here is alot of info about asterisk file conversion.

http://www.voip-info.org/wiki/view/Asterisk+sound+files

And for sure you can use asterisk(if it compiled with mp3 support)

asterisk -rx "file convert filename.mp3 filename.gsm"

If you want convert using sox, you have recompile sox with libmad support. Here is script:

cd /usr/src/

wget -c "http://downloads.sourceforge.net/mad/libmad-0.15.1b.tar.gz?modtime=1076976000&big_mirror=0"
wget -c 'http://downloads.sourceforge.net/mad/libid3tag-0.15.1b.tar.gz?modtime=1076976000&big_mirror=0'
wget -c "http://sourceforge.net/projects/sox/files/sox/14.3.2/sox-14.3.2.tar.gz/download"
wget -c http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
wget -c "http://downloads.sourceforge.net/mad/madplay-0.15.2b.tar.gz?modtime=1077580800&big_mirror=0"
CPU=4

for i in libid3tag libmad madplay lame sox 
do
cd /usr/src/
tar -xzf $i-*.gz

cd /usr/src/$i*
./configure;
make -j $CPU
make install
done;
echo /usr/local/lib/ >>/etc/ld.so.conf
ldconfig
sox
ln -s /usr/local/bin/sox /usr/bin/sox
arheops
  • 15,544
  • 1
  • 21
  • 27
1

I used a software called "switch" from NCH Software and work very well to GSM conversion and with Elastix PBX. The only problem is on Elastix GUI the upload that dont work on System Records, so I had to upload using SCP aka SFTP over SSH.

http://www.nch.com.au/switch/

-1

Solution 1:-

localhost*CLI> help file convert

Usage: file convert Convert from file_in to file_out. If an absolute path is not given, the default Asterisk sounds directory will be used.

Example: file convert tt-monkeys.gsm tt-monkeys.ulaw

Solution 2:- There are some online tool available which can work for you. https://convertio.co/ It can convert your file in almost 20 formats. e.g gsm, wav, cdma,wma etc.

Joginder Malik
  • 455
  • 5
  • 12