How does the Sox Compand Transfer Function Work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Sox's Compand Transfer Function

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).

original audio intensity

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.

sox compand plot -70,-60,-20

When I plot the resulting dB level of the audio, I get this:

audio intensity after compand -70,-60,-20

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:

sox plot transfer function for -70,-60,-10

I expected all the meaningful audio to be compressed into the -10dB - 0dB range.

audio intensity levels after compand -70,-60,-10

-91,-90,-10

Plotting the transfer function:

sox plot transfer function for -91,-90,-10

I expected a great deal of compression (nearly everything in the -10dB - 0dB range).

audio intensity levels after compand -91,-90,-10

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

[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux