That’s called an “expander”.
A compressor reduces the range between loud and quiet sounds (compresses the “dynamic range”), either by lowering peaks or by raising quiet parts.
An expander increases the range between loud and quiet sounds (expands the “dynamic range”), either by raising peaks or by lowering quiet parts.
The core function in the audio processing of this effect is the “gate” function at line 213:
(gate gatefollow lookahead risetime falltime floor threshold)
“gatefollow” is a copy of the input signal that has passed through a high pass filter (to remove DC offset and low frequency rumble), and been converted to mono (if it was a stereo track).
The GATE function is described in the manual here: http://www.cs.cmu.edu/~rbd/doc/nyquist/part8.html#index312
(gate sound lookahead risetime falltime floor threshold) > > [LISP]
Generate an exponential rise and decay intended for noise gate implementation. The decay starts when the signal drops below threshold and stays there for longer than lookahead (a FLONUM in seconds). (The signal begins to drop when the signal crosses threshold, not after lookahead.) Decay continues until the value reaches floor (a FLONUM), at which point the decay stops and the output value is held constant. Either during the decay or after the floor is reached, if the signal goes above threshold, then the ouptut value will rise to unity (1.0) at the point the signal crosses the threshold. Because of internal lookahead, the signal actually begins to rise before the signal crosses threshold. The rise is a constant-rate exponential and set so that a rise from floor to unity occurs in risetime. Similary, the fall is a constant-rate exponential such that a fall from unity to floor takes falltime.
The plug-in modifies the behaviour of GATE to give the function GATE-S.
To strip down the NOISEGATE function to its basics:
(defun noisegate (s-in gatefollow lookahead risetime falltime floor threshold Hz)
(mult s-in
(gate gatefollow lookahead risetime falltime floor threshold)))
However, there’s a problem that the GATE function can create very high gain in some circumstances, which will cause unwanted level boost.
To prevent that from happening, the output from the GATE function needs to be pegged to a maximum level of 1.0 (unity gain). We can do that by clipping the output from GATE:
(defun noisegate (s-in gatefollow lookahead risetime falltime floor threshold Hz)
(mult s-in
(clip (gate gatefollow lookahead risetime falltime floor threshold) 1.0)))
Beyond that, you can modify the gain envelope any way you like.