Skip to main content

Topic: SoX Questions (Read 3122 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • editaudio
  • [*]
SoX Questions
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.

  • bandpass
  • [*][*][*][*]
SoX Questions
Reply #1
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.

  • editaudio
  • [*]
SoX Questions
Reply #2
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?

  • bandpass
  • [*][*][*][*]
SoX Questions
Reply #3
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.

  • editaudio
  • [*]
SoX Questions
Reply #4
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.

  • chi
  • [*]
SoX Questions
Reply #5
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?

  • editaudio
  • [*]
SoX Questions
Reply #6
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]
                         |
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||
                         |