2
votes

I'm currently working on some telephony integration with Asterisk and a PHP web interface. I want to give the user an option to upload their own custom greeting in a wav file, and then once it's on the server convert the wav to a gsm file at 8000hz. Currently, i'm trying to use sox to accomplish this.

However, it seems like when I convert between anything other than an 8khz sav to gsm, the gsm file is severely distorted. It's almost like it slows down the file by a factor of 10 (a 3 second intro in wav format turns into a 30 second gsm file) I've tried several combinations of speed and resampling to no avail. Ideally, I would like to take any wav file that's uploaded and convert it, without putting too much responsibility on the user to encode it properly. I'm definitely not an audiophile, so if anybody could point me in the right direction it would be much appreciated.

4
What is the current command line argument you are using?Aaron Ray

4 Answers

5
votes

This is the command that I use to convert regular 16-bit .wav files to 8-bit mono .gsm files (works fine):

sox input.wav -r 8000 -c1 output.gsm lowpass 4000 compand 0.02,0.05 -60,-60,-30,-10,-20,-8,-5,-8,-2,-8 -8 -7 0.05
0
votes

I have seen cases with sox where I needed to break up changes and pipe them one after another rather then in one command.

What does your sox cmd look like?

Could you first convert the wav to 8khz, then transcode, piping the output from the one sox call to the other?

0
votes

I use

sox foo.wav -r 8000 -c1 foo.gsm resample -ql
0
votes

Just a little late, I current use:

sox somefile.wav -r 8000 -c1 output.gsm