SOX-wave conversion URGENT

umesh.gk

Member
Joined
Jul 14, 2008
Messages
11
Reaction score
0
we are using SOX sound exchange tool for converting the wave file, and we were just using/testing the tools capabilty.

procedure followed is file.wav to SOX to get file.raw data, and again we passed the file.raw to the SOX tool to convert it back to wave file (sample.wav), but on playing this audio file in the windows media player, all I could hear is only noise.

Commands given.

step1:
sox -r 8000 -2 file.wav file.raw
step2:
sox -r 8000 -2 -u file.raw sample.wav

played sample.wav in windows media player , but we could only hear noise.

could you please tell me, why did the noise get added in it, or is the procedure which we followed was wrong or not ?


Please do reply at your earliest.

Regards,

Umesh G.K.
 
I think that the distortion problem is related to using unsigned rather than signed data. This procedure appears to work for two different versions of sox (12.18.2 and 14.0.1). If you are still having distortion problems you could also try to reduce the volume using the -v flag (can even use a fraction such as -v 0.1 etc.).

sox -r 8000 -s -w file.wav file.raw
sox -r 8000 -s -w file.raw sample.wav
 
Last edited:
It worked

thanks Yotch,

we gave the following commands :
sox -r 8000 -s -w file.wav file.raw
sox -r 8000 -s -w file.raw sample.wav

,but too then there were noise in the wave file.

The actual wave file (file.wav) playing time was 3sec, but the sample.wav file had a playing time of 41 sec. so we increased the speed of the file and it started to play properly.

the command given was:

sox sample.wav final.wav speed 11
 
@umesh.gk: Good news that your file is now playing back correctly.

I think that the reason why you need to change the speed setting is because your original .wav file is not recorded at 8000 samples per second. Type the command sox file.wav -e stat and divide the number of samples by the length in seconds to find the sampling rate.

Here is a sample file (male.wav) that I used to test the conversion process.
http://www.yousendit.com/download/TTdFZUNnQ3RRR2MwTVE9PQ

The -e stat option returns 408226 samples in 51.028250 seconds i.e. 8000 samples per second. The file can then be converted correctly using a sampling rate of 8000.
sox -r 8000 -s -w male.wav male.raw
sox -r 8000 -s -w male.raw sample.wav

If you repeat the conversions using -r 6000 for example then the pitch of the final sample.wav file will be too low and will need to be increased using the speed option.
 
Top
Sign up to the MyBroadband newsletter
X