HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: editaudio on 2012-10-29 23:03:17

Title: SoX Questions
Post by: editaudio on 2012-10-29 23:03:17
I am new to SoX and have a couple questions.

1) I have been using Chris's Dynamic Compressor on podcasts and music to listen in the car and my iPod in noisy environments. I usually apply a ratio of 0.7 to 0.9. Does anyone know how to get the equivalent results in Sox?

2) I am using the compand effect and getting a lot of clipping. Does the -G and norm options apply to the input?  How do I normalize the output and prevent clipping?

sox -G --norm=-3 alien.wav alienout.wav. compand  0.3,1 -90,-90,-70,-70,-60,-20,0,0 -5 0 0.2
sox WARN compand: compand clipped 46934 samples; decrease volume?

I would appreciate any comments and suggestions.
Title: SoX Questions
Post by: bandpass on 2012-10-30 07:00:23
No, IIRC -G doesn't work for compand, you have to play around with the manual attenuation parameter (-5 in your example): err on the cautious side and put "norm -3" after the compand command.

Google "compand for rock concerts" for a lot more info.
Title: SoX Questions
Post by: editaudio on 2012-10-30 16:53:13
Thanks for the rock concerts suggestion.

Norm does not seem to work:

sox alien.wav alienout.wav compand .2,.4 6:-90,-90,-80,-40,-10,0 -10 -30 .2
sox WARN compand: compand clipped 5293 samples; decrease volume?

sox alien.wav alienout.wav compand .2,.4 6:-90,-90,-80,-40,-10,0 -10 -30 .2 norm 0
sox WARN compand: compand clipped 5293 samples; decrease volume?

sox alien.wav alienout.wav compand .2,.4 6:-90,-90,-80,-40,-10,0 -10 -30 .2 norm -3
sox WARN compand: compand clipped 5293 samples; decrease volume?
Title: SoX Questions
Post by: bandpass on 2012-10-30 17:34:20
Keep increasing the compand attenuation until the clips go away (they've already reduced in number), then attenuate by a further say, 10 dB.

SoX is 32-bit internally, so there's nothing to worry about with this attenuation (and the norm will bring the level back up if on some tracks not all the attenuation is needed).

HTH.
Title: SoX Questions
Post by: editaudio on 2012-10-30 18:42:43
Thanks to your suggestions the clipping is now under control.  Looking at the file in a waveform editor, it's very "spikey" and "peaky".  Compressor and Audacity is able to make it more "blocky", "smooth", and "flat". I've tried many different combinations of settings but just can't seem to get good results with SoX.
Title: SoX Questions
Post by: chi on 2012-11-01 10:32:31
Looking at the file in a waveform editor, it's very "spikey" and "peaky".  Compressor and Audacity is able to make it more "blocky", "smooth", and "flat". I've tried many different combinations of settings but just can't seem to get good results with SoX.


To get a flatter waveform, you’ll need to make the transfer function flatter too, and possibly shorten the attack time. E.g.,
Code: [Select]
compand 0.05,0.2 6:-90,-90,-80,-1,-10,0 -10 -30 .1
yields quite a level waveform for me. Whether that’s useful or not is a different question.

Are you aware that
Code: [Select]
sox --plot=method ...
(where “method” can be gnuplot or octave) will plot the transfer function?
Title: SoX Questions
Post by: editaudio on 2012-11-01 19:28:40
The transfer function looks good, but the audio file has many tall spikes, so to avoid clipping, the volume gets reduced substantially.

SoX waveform:
Code: [Select]
     |
     |                               |
     |                               |
     |    |                          |
     |    |                          |
|||||||||||||||||||||||||||||||||||||||||||||||||||||
     |    |                          |
     |                               |
     |                               |
     |


Chris's Dynamic Compressor waveform:
Code: [Select]
                         |
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
                         |