sox: Input and Output rates must be different to use resample effect

Problem: While using SOX for converting audio files in one single format, we faced an issue with SOX. It doesn’t allow resampling of media file if source file sample rate id same as of destincation file e.g. if you are trying to convert media files to Mono Channel, Audio Sample rate 8kHz and Audio sample size 16 bit and if origincal file has same sample rate of 8kHz, SOX gives an error and doesn’t ignore it.

The command for modifying the origincal media file was
'sox foo-in.* -r 8000 -c 1 -s -w foo-out.wav resample -ql'

and error was following:

sox: Input and Output rates must be different to use resample effect

Solution: We need to figure out the sampling rate of audio file and change the command accordingly

Implementation: SOX itself gives details about the input media file using following command

sox -V input.file -e

Use above command for getting details about the sample rate and use command

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

for converting your media file and skip the resampling of it is not required i.e. if input and output rates are same.

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

[...] See the solution in the post but that will suit you if you are using Sox manually. [...]

Leave a comment

(required)

(required)