开发者

Converting from 16-bit WAV to GSM using SOX

开发者 https://www.devze.com 2023-03-21 17:22 出处:网络
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 t

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 con开发者_开发百科vert 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.


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


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?


I use

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


Just a little late, I current use:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号