Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce volume of audio file by percentage value using SOX

Tags:

sox

I would like to reduce the volume of an audio file by 10% (so that the new volume will be 90% of the original). How can this be done using SOX? According to the SOX manual it supports a volume option:

-v, --volume FACTOR

Adjust volume by a factor of FACTOR. This is a linear (amplitude) adjustment, so a number less than 1 decreases the volume; greater than 1 increases it. If a negative number is given, then in addition to the volume adjustment, the audio signal will be inverted.

Does that mean that the command sox -v 0.9 audio.wav audio.wav will give me an audio file at 90% the volume of the original?

like image 730
Benjen Avatar asked Feb 14 '14 09:02

Benjen


1 Answers

It appears to be correct, that

sox -v 0.9 in.wav out.wav

will give you an audio file with 90% volume of the original.

stat will reveal this, when you compare the Maximum amplitude and Minimum amplitude output values.

sox in.wav tmp.wav stat
sox out.wav tmp.wav stat

Note, that using the same file for both input and output file will result in a broken file.

like image 103
qubodup Avatar answered Oct 20 '22 05:10

qubodup