compressors.lib
A library of compressor effects. Its official prefix is co
.
Functions Reference
(co.)peak_compression_gain_mono
Mono dynamic range compressor gain computer.
peak_compression_gain_mono
is a standard Faust function
Usage
_ : peak_compression_gain_mono(strength,thresh,att,rel,knee,prePost) : _
Where:
strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold: Below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.prePost
: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detector It uses a strength parameter instead of the traditional ratio, in order to be able to function as a hard limiter. For that you'd need a ratio of infinity:1, and you cannot express that in Faust Sometimes even bigger ratios are usefull: For example a group recording where one instrument is recorded with both a close microphone and a room microphone, and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- Digital Dynamic Range Compressor Design A Tutorial and Analysis DIMITRIOS GIANNOULIS (Dimitrios.Giannoulis@eecs.qmul.ac.uk) MICHAEL MASSBERG (michael@massberg.org) AND JOSHUA D. REISS (josh.reiss@eecs.qmul.ac.uk)
(co.)peak_compression_gain_N_chan
N channel dynamic range compressor gain computer.
peak_compression_gain_N_chan
is a standard Faust function
Usage
si.bus(N) : peak_compression_gain_N_chan(strength,thresh,att,rel,knee,prePost,link,N) : si.bus(N)
Where:
strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold: Below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.prePost
: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reductionN
: the number of channels of the compressor It uses a strength parameter instead of the traditional ratio, in order to be able to function as a hard limiter. For that you'd need a ratio of infinity:1, and you cannot express that in Faust Sometimes even bigger ratios are usefull: For example a group recording where one instrument is recorded with both a close microphone and a room microphone, and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- Digital Dynamic Range Compressor Design A Tutorial and Analysis DIMITRIOS GIANNOULIS (Dimitrios.Giannoulis@eecs.qmul.ac.uk) MICHAEL MASSBERG (michael@massberg.org) AND JOSHUA D. REISS (josh.reiss@eecs.qmul.ac.uk)
(co.)FFcompressor_N_chan
feed forward N channel dynamic range compressor.
FFcompressor_N_chan
is a standard Faust function
Usage
si.bus(N) : FFcompressor_N_chan(strength,thresh,att,rel,knee,prePost,link,meter,N) : si.bus(N)
Where:
strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold: Below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.prePost
: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reductionmeter
: a gain reduction meter. It can be implemented like so: meter = <:(, (ba.linear2db:max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;N
: the number of channels of the compressor It uses a strength parameter instead of the traditional ratio, in order to be able to function as a hard limiter. For that you'd need a ratio of infinity:1, and you cannot express that in Faust Sometimes even bigger ratios are usefull: For example a group recording where one instrument is recorded with both a close microphone and a room microphone, and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- Digital Dynamic Range Compressor Design A Tutorial and Analysis DIMITRIOS GIANNOULIS (Dimitrios.Giannoulis@eecs.qmul.ac.uk) MICHAEL MASSBERG (michael@massberg.org) AND JOSHUA D. REISS (josh.reiss@eecs.qmul.ac.uk)
(co.)FBcompressor_N_chan
feed back N channel dynamic range compressor.
FBcompressor_N_chan
is a standard Faust function
Usage
si.bus(N) : FBcompressor_N_chan(strength,thresh,att,rel,knee,prePost,link,meter,N) : si.bus(N)
Where:
strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold: Below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.prePost
: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reductionmeter
: a gain reduction meter. It can be implemented like so: meter = <:(, (ba.linear2db:max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;N
: the number of channels of the compressor It uses a strength parameter instead of the traditional ratio, in order to be able to function as a hard limiter. For that you'd need a ratio of infinity:1, and you cannot express that in Faust Sometimes even bigger ratios are usefull: For example a group recording where one instrument is recorded with both a close microphone and a room microphone, and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- Digital Dynamic Range Compressor Design A Tutorial and Analysis DIMITRIOS GIANNOULIS (Dimitrios.Giannoulis@eecs.qmul.ac.uk) MICHAEL MASSBERG (michael@massberg.org) AND JOSHUA D. REISS (josh.reiss@eecs.qmul.ac.uk)
(co.)FFFBcompressor_N_chan
feed forward / feed back N channel dynamic range compressor.
the feedback part has a much higher strength, so they end up sounding similar
FFFBcompressor_N_chan
is a standard Faust function
Usage
si.bus(N) : FFFBcompressor_N_chan(strength,thresh,att,rel,knee,prePost,link,FBFF,meter,N) : si.bus(N)
Where:
strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold: Below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.prePost
: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reductionFFFB
: fade between feed forward (0) and feed back (1) compression.meter
: a gain reduction meter. It can be implemented like so: meter = <:(, (ba.linear2db:max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;N
: the number of channels of the compressor It uses a strength parameter instead of the traditional ratio, in order to be able to function as a hard limiter. For that you'd need a ratio of infinity:1, and you cannot express that in Faust Sometimes even bigger ratios are usefull: For example a group recording where one instrument is recorded with both a close microphone and a room microphone, and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- Digital Dynamic Range Compressor Design A Tutorial and Analysis DIMITRIOS GIANNOULIS (Dimitrios.Giannoulis@eecs.qmul.ac.uk) MICHAEL MASSBERG (michael@massberg.org) AND JOSHUA D. REISS (josh.reiss@eecs.qmul.ac.uk)
(co.)RMS_compression_gain_mono
Mono RMS dynamic range compressor gain computer.
RMS_compression_gain_mono
is a standard Faust function
Usage
_ : RMS_compression_gain_mono(strength,thresh,att,rel,knee,prePost) : _
Where:
strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold: Below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.prePost
: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detector It uses a strength parameter instead of the traditional ratio, in order to be able to function as a hard limiter. For that you'd need a ratio of infinity:1, and you cannot express that in Faust Sometimes even bigger ratios are usefull: For example a group recording where one instrument is recorded with both a close microphone and a room microphone, and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- Digital Dynamic Range Compressor Design A Tutorial and Analysis DIMITRIOS GIANNOULIS (Dimitrios.Giannoulis@eecs.qmul.ac.uk) MICHAEL MASSBERG (michael@massberg.org) AND JOSHUA D. REISS (josh.reiss@eecs.qmul.ac.uk)
(co.)RMS_compression_gain_N_chan
RMS N channel dynamic range compressor gain computer.
RMS_compression_gain_N_chan
is a standard Faust function
Usage
si.bus(N) : RMS_compression_gain_N_chan(strength,thresh,att,rel,knee,prePost,link,N) : si.bus(N)
Where:
strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold: Below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.prePost
: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reductionN
: the number of channels of the compressor It uses a strength parameter instead of the traditional ratio, in order to be able to function as a hard limiter. For that you'd need a ratio of infinity:1, and you cannot express that in Faust Sometimes even bigger ratios are usefull: For example a group recording where one instrument is recorded with both a close microphone and a room microphone, and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- Digital Dynamic Range Compressor Design A Tutorial and Analysis DIMITRIOS GIANNOULIS (Dimitrios.Giannoulis@eecs.qmul.ac.uk) MICHAEL MASSBERG (michael@massberg.org) AND JOSHUA D. REISS (josh.reiss@eecs.qmul.ac.uk)
(co.)RMS_FFFBcompressor_N_chan
RMS feed forward / feed back N channel dynamic range compressor.
the feedback part has a much higher strength, so they end up sounding similar
RMS_FFFBcompressor_N_chan
is a standard Faust function
Usage
si.bus(N) : RMS_FFFBcompressor_N_chan(strength,thresh,att,rel,knee,prePost,link,FBFF,meter,N) : si.bus(N)
Where:
strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inatt
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold: Below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction.prePost
: places the level detector either at the input or after the gain computer; this turns it from a linear return-to-zero detector into a log domain return-to-threshold detectorlink
: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reductionFFFB
: fade between feed forward (0) and feed back (1) compression.meter
: a gain reduction meter. It can be implemented like so: meter = <:(, (ba.linear2db:max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;N
: the number of channels of the compressor It uses a strength parameter instead of the traditional ratio, in order to be able to function as a hard limiter. For that you'd need a ratio of infinity:1, and you cannot express that in Faust Sometimes even bigger ratios are usefull: For example a group recording where one instrument is recorded with both a close microphone and a room microphone, and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft. to save CPU we cheat a bit, in a similar way as in the original libs: instead of crosfading between two sets of gain calculators as above, we take the abs of the audio from both the FF and FB, and crossfade between those, and feed that into one set of gain calculators again the strength is much higher when in FB mode, but implemented differently
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- Digital Dynamic Range Compressor Design A Tutorial and Analysis DIMITRIOS GIANNOULIS (Dimitrios.Giannoulis@eecs.qmul.ac.uk) MICHAEL MASSBERG (michael@massberg.org) AND JOSHUA D. REISS (josh.reiss@eecs.qmul.ac.uk)
(co.)RMS_FBcompressor_peak_limiter_N_chan
N channel RMS feed back compressor into peak limiter feeding back into the FB compressor.
By combining them this way, they complement each other optimally:
The RMS compressor doesn't have to deal with the peaks,
and the peak limiter get's spared from the steady state signal.
the feedback part has a much higher strength, so they end up sounding similar
RMS_FBcompressor_peak_limiter_N_chan
is a standard Faust function
Usage
si.bus(N) : RMS_FBcompressor_peak_limiter_N_chan(strength,thresh,threshLim,att,rel,knee,link,meter,N) : si.bus(N)
Where:
strength
: strength of the compression (0 = no compression, 1 means hard limiting, >1 means over-compression)thresh
: dB level threshold above which compression kicks inthreshLim
: dB level threshold above which the brick wall limiter kicks inatt
: attack time = time constant (sec) when level & compression going up this is also used as the release time of the limiterrel
: release time = time constant (sec) coming out of compressionknee
: a gradual increase in gain reduction around the threshold: Below thresh-(knee/2) there is no gain reduction, above thresh+(knee/2) there is the same gain reduction as without a knee, and in between there is a gradual increase in gain reduction. the limiter uses a knee half this sizelink
: the amount of linkage between the channels. 0 = each channel is independent, 1 = all channels have the same amount of gain reductionmeter
: a gain reduction meter. It can be implemented like so: meter = <:(, (ba.linear2db:max(maxGR):meter_group((hbargraph("[1][unit:dB][tooltip: gain reduction in dB]", maxGR, 0))))):attach;N
: the number of channels of the compressor It uses a strength parameter instead of the traditional ratio, in order to be able to function as a hard limiter. For that you'd need a ratio of infinity:1, and you cannot express that in Faust Sometimes even bigger ratios are usefull: For example a group recording where one instrument is recorded with both a close microphone and a room microphone, and the instrument is loud enough in the room mic when playing loud, but you want to boost it when it is playing soft.
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- Digital Dynamic Range Compressor Design A Tutorial and Analysis DIMITRIOS GIANNOULIS (Dimitrios.Giannoulis@eecs.qmul.ac.uk) MICHAEL MASSBERG (michael@massberg.org) AND JOSHUA D. REISS (josh.reiss@eecs.qmul.ac.uk)
Backward compatibility section
These functions are superseded by the ones above. They are included for backward compatibility.
Functions Reference
(co.)compressor_mono
Mono dynamic range compressors.
compressor_mono
is a standard Faust function.
Usage
_ : compressor_mono(ratio,thresh,att,rel) : _
Where:
ratio
: compression ratio (1 = no compression, >1 means compression)thresh
: dB level threshold above which compression kicks in (0 dB = max level)att
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compression
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- https://ccrma.stanford.edu/~jos/filters/Nonlinear_Filter_Example_Dynamic.html
- Albert Graef's "faust2pd"/examples/synth/compressor_.dsp
- More features: https://github.com/magnetophon/faustCompressors
(co.)compressor_stereo
Stereo dynamic range compressors.
Usage
_,_ : compressor_stereo(ratio,thresh,att,rel) : _,_
Where:
ratio
: compression ratio (1 = no compression, >1 means compression)thresh
: dB level threshold above which compression kicks in (0 dB = max level)att
: attack time = time constant (sec) when level & compression going uprel
: release time = time constant (sec) coming out of compression
References
- http://en.wikipedia.org/wiki/Dynamic_range_compression
- https://ccrma.stanford.edu/~jos/filters/Nonlinear_Filter_Example_Dynamic.html
- Albert Graef's "faust2pd"/examples/synth/compressor_.dsp
- More features: https://github.com/magnetophon/faustCompressors
(co.)limiter_1176_R4_mono
A limiter guards against hard-clipping. It can be
implemented as a compressor having a high threshold (near the
clipping level), fast attack and release, and high ratio. Since
the ratio is so high, some knee smoothing is
desirable ("soft limiting"). This example is intended
to get you started using compressor_* as a limiter, so all
parameters are hardwired to nominal values here.
Ratios: 4 (moderate compression), 8 (severe compression),
12 (mild limiting), or 20 to 1 (hard limiting)
Att: 20-800 MICROseconds (Note: scaled by ratio in the 1176)
Rel: 50-1100 ms (Note: scaled by ratio in the 1176)
Mike Shipley likes 4:1 (Grammy-winning mixer for Queen, Tom Petty, etc.)
Faster attack gives "more bite" (e.g. on vocals)
He hears a bright, clear eq effect as well (not implemented here).
limiter_1176_R4_mono
is a standard Faust function.
Usage
_ : limiter_1176_R4_mono : _;
Reference:
(co.)limiter_1176_R4_stereo
A limiter guards against hard-clipping. It can be implemented as a compressor having a high threshold (near the clipping level), fast attack and release, and high ratio. Since the ratio is so high, some knee smoothing is desirable ("soft limiting"). This example is intended to get you started using compressor_* as a limiter, so all parameters are hardwired to nominal values here. Ratios: 4 (moderate compression), 8 (severe compression), 12 (mild limiting), or 20 to 1 (hard limiting) Att: 20-800 MICROseconds (Note: scaled by ratio in the 1176) Rel: 50-1100 ms (Note: scaled by ratio in the 1176) Mike Shipley likes 4:1 (Grammy-winning mixer for Queen, Tom Petty, etc.) Faster attack gives "more bite" (e.g. on vocals) He hears a bright, clear eq effect as well (not implemented here)
Usage
_,_ : limiter_1176_R4_stereo : _,_;