Wednesday, 30 July 2014

Converting WAV file to GSM / Asterisk Audio file?

By vm  |  05:52 No comments

You can use SOX command in linux

# man sox

# sox NONasteriskXXX.wav -c 1 -r 8000 asteriskXXX.gsm

(it resamples the non asterisk audio file in single channel audio with 8Khz sampling frequency)

If you have tons of wav file, it's waste of time to type a command for every individual wav files. So, you can do the following

Let's say you have WAV files in /tmp/recordings directory.

/tmp/recordings# for i in *
> do
> sox $i -c 1 -r 8000 `echo $i|sed "s/.wav/.gsm/"`
> done

Ooola.. it's done!!! You just converted all the files in /tmp/recordings directory from WAV to gsm.

Here, we are using for loop to go thru' each files in the /tmp/recordings directory. '$i' returns the file name. 'sed "s/.wav/.gsm/"' renames the file from .wav to .gsm

vm Author: vm

Hello, I am Author, decode to know more: In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet.

Related Posts

0 comments:

E-mail Newsletter

Sign up now to receive breaking news and to hear what's new with us.

Recent Articles

© 2014 VOIP4Learn. WP themonic converted by Bloggertheme9. Powered by Blogger.