Convert formats of computer audio files

Problem: We had this sound stack/VoIP stack which was unable to play all format of media files. Reason for this restriction was size of stack and that was our restriction too, we wanted to keep stack size as small as possible and not include codecs in it. This VoIP stack could play a certain format of media file i.e. WAV format, Audio sample size 16 bit and Audio sample rate 8kHz.

This module has to play media files input from a web application which was open for all users. We could not ask all people to convert their media in certain format because generally the end user does not have much technical information up to these details.

Solution: Try to convert all type of media into required format i.e. WAV, 16 bit and 8kHz.

Implementation: After searching on internet we got ‘SOX’ i.e. Sound eXchange, the swiss army knife of sound processing programs. SoX is a command line utility that can convert various formats of computer audio files in to other formats. It can also apply various effects to these sound files during the conversion. As an added bonus, SoX can play and record audio files on several unix-style platforms.

Use following command to convert media into WAV, 16 bit and 8kHz format:

sox foo-in.* -r 8000 -c 1 -s -w foo-out.wav resample -ql

Read more documenation at http://sox.sourceforge.net/

Most Commented Posts

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)