2

audacity has a noise gate plugin that works nicely. I am looking for a command line equivalent - but am unable to figure out SoX compand command to do it. Could anyone tell me the sox equivalent of audacity noise gate ? For example, I use in audacity "Gate frequencies above: 0.0", level reduction: -12, Gate Threshold -48.0, Attack/Decay 250.0 ?

user428900
  • 7,091
  • 6
  • 23
  • 18

3 Answers3

2

Have you tried using the compand command in SOX? See http://sox.sourceforge.net/sox.html, scroll down to the section for the compand command, and see where it says:

In the next example, compand is being used as a noise-gate for when the noise is at 
a lower level than the signal:
play infile compand .1,.2 −inf,−50.1,−inf,−50,−50 0 −90 .1
mti2935
  • 11,465
  • 3
  • 29
  • 33
1

From the sox man page, you can hack the compand dynamic range compressor to only gate the noise

sox infile outfile compand .1,.2 −inf,−50.1,−inf,−50,−50 0 −90 .1

breaking down the format:

.1,.2
attack1,decay1{,attack2,decay2}

attack and decay are set to small values of .1 and .2, which basically sets the window size.

−inf,−50.1,−inf,−50,−50
[soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2}

this is where we define the noise gate, negative infinity for the soft knee, in dB set to -50.1, negative infinity for the out, then -50 dB and -50 dB. This is where you adjust the gate level. If you want to remove more noise change the value to 30 dB:

−inf,−30.1,−inf,−30,−30

if the gate is too large and it is clipping content, then lower the gate threshold to 70 dB:

−inf,−70.1,−inf,−70,−70

in the last part

0 −90 .1
[gain [initial-volume-dB [delay]]]

finally we set the gain to 0, initial volume to -90 dB, and the delay to 0.1 sec.

I think many people (including myself) do not have a firm grasp on the compand parameters, see for example.

vossman77
  • 1,397
  • 14
  • 13
-2
sox noise.wav -n noiseprof | play sound.wav noisered

will do noise gating as audacity does.

jthill
  • 55,082
  • 5
  • 77
  • 137
Alex
  • 1