I’m having trouble choosing compand parameters to get the results I want. I believe the problem is in my engineering the transfer function for sox’s compand effect.
According to the sox docs:
compand attack1,decay1{,attack2,decay2}
[soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2}
[gain [initial-volume-dB [delay]]]
My goal is to compress all the audio in a file to the top 20 dB of the available amplitude range (to overcome the noisy environment in which I’ll be listening).
Experiment
Here’s a plot of the first ~25 seconds of the file. (Note: my method for plotting dB is potentially suspect. The Python code for it may be found here).
Recommended: -70,-60,-20
The sox docs also list a “common” transfer set of parameters: 0.3,1 6:−70,−60,−20 −5 −90 0.2
. I used something similar: 0,.1 -70,-60,-20
(leaving out the gain, initial volume, and optional soft-knee value).
The sox docs describe this transfer function:
The transfer function (‘6:−70,...’) says that very soft sounds (below −70dB) will remain unchanged. This will stop the compander from boosting the volume on ‘silent’ passages such as between movements. However, sounds in the range −60dB to 0dB (maximum volume) will be boosted so that the 60dB dynamic range of the original music will be compressed 3-to-1 into a 20dB range, which is wide enough to enjoy the music but narrow enough to get around the road noise.
When I tell sox to plot the transfer function, I expect output levels to be mostly in the -20dB - 0dB range.
When I plot the resulting dB level of the audio, I get this:
This is not what I expected. I was expecting the dB level to be almost entirely in the -20dB - 0dB range, but what I see is most of it in the -60dB - 0dB range. What is wrong with my expectations?
I attempted a few other transfer functions, with results a little more to my liking, but never what I was expecting or wanted.
-70,-60,-10
Plotting the transfer function:
I expected all the meaningful audio to be compressed into the -10dB - 0dB range.
-91,-90,-10
Plotting the transfer function:
I expected a great deal of compression (nearly everything in the -10dB - 0dB range).
Conclusions?
I can only barely tell a difference between the results of the various transfer functions I tried. At no point was the dB level of the audio compressed to within the range I was expecting.
Sox Source Code
https://github.com/chirlu/sox/blob/master/src/compand.c
Examination of this file doesn't sufficiently enlighten me to enable me to get what I want out of companding. I don't have criticism of the code—I just don't understand it.
What do I not understand about the transfer function?
I don't see the actual output of Sox's compand doing what is described in the docs. Can you help me understand how to use the compand effect?
Thanks.
todd.
_______________________________________________ Sox-users mailing list Sox-users@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/sox-users