ofxPDSP
pdsp::Compressor Class Reference

Stereo Feed-forward compressor with peak-based or RMS detection and optional lookahead and stereo linking. More...

#include <Compressor.h>

Inheritance diagram for pdsp::Compressor:
pdsp::Patchable

Public Member Functions

 Compressor (bool linkChannels)
 
 Compressor (const Compressor &other)
 
Compressoroperator= (const Compressor &other)
 
void RMS (float window_ms=50.0f)
 sets the ms window for the RMS detector and activates RMS detection mode More...
 
void peak ()
 activates peak detection mode. Peak detection is default.
 
void analog ()
 sets the envelope follower behavior to analog (slightly slower).
 
void digital (bool lookahead=false)
 sets the envelope follower behavior digital (more responsive, default behavior). Optional boolean value for activating the lookahead function (false by default). More...
 
void stereoLink (bool active)
 links the signal detection for stereo channels. Activated by default. More...
 
Patchablech (size_t index)
 Uses the selected channel as input/output for the patching operation. 0 is for the left channel (default input/output) and 1 is for the right channel. Index values outside of range are remapped to 0 or 1. More...
 
Patchablein_attack ()
 Sets "attack" as selected input and returns this module ready to be patched. This input is the attack time of the compressor in milliseconds. Init default value is 10 ms.
 
Patchablein_release ()
 Sets "release" as selected input and returns this module ready to be patched. This input is the release time of the compressor in milliseconds. Init default value is 50 ms.
 
Patchablein_threshold ()
 Sets "threshold" as selected input and returns this module ready to be patched. This is the threshold of the gain reduction. Default init value is -20dB.
 
Patchablein_ratio ()
 Sets "ratio" as selected input and returns this module ready to be patched. This is the threshold of the gain reduction. If ratio is greater than 40 this module acts as a limiter. Default init value is 4.0f, that means 4:1 compression.
 
Patchablein_knee ()
 Sets "knee" as selected input and returns this module ready to be patched. This is the knee of the compressor. Init default value is 0dB.
 
float meter_GR () const
 returns the gain reduction value (updated once each audio buffer). This method is thread-safe.
 
- Public Member Functions inherited from pdsp::Patchable
void resetInputToDefault ()
 resets the selected input to the default.
 
void resetOutputToDefault ()
 resets the selected output to the default.
 
Patchablein (const char *tag)
 sets the selected input to the one tagged with "tag", if tag is a valid string, and returns this Patchable ready to be patched. More...
 
Patchableout (const char *tag)
 sets the selected output to the one tagged with "tag", if tag is a valid string, and returns this Patchable ready to be patched. More...
 
void disconnectIn ()
 disconnects all the outputs connected to the selected input, then resets the selected input to the default.
 
void disconnectOut ()
 disconnects all the inputs connected to the selected output, then resets the selected output to the default.
 
void disconnectAll ()
 disconnects all the inputs and outputs to their connected outputs and inputs. Also resets the selected input and output to the default.
 
InputNodegetSelectedInput ()
 returns the selected input, you can patch a Patchable or OutputNode to it with the >> operator.
 
OutputNodegetSelectedOutput ()
 returns the selected output, you can patch it to another Patchable or InputNode with the >> operator.
 
std::vector< std::string > getInputsList ()
 returns a vector of the valid input tags
 
std::vector< std::string > getOutputsList ()
 returns a vector of the valid input tags
 

Additional Inherited Members

- Protected Member Functions inherited from pdsp::Patchable
void addOutput (const char *tag, OutputNode &output)
 method to add outputs when constructing a Unit More...
 
void addInput (const char *tag, InputNode &input)
 method to add inputs when constructing a Unit More...
 
void addModuleOutput (const char *tag, Patchable &unit)
 method to add outputs when constructing a module More...
 
void addModuleInput (const char *tag, Patchable &unit)
 method to add outputs when constructing a module More...
 

Detailed Description

Stereo Feed-forward compressor with peak-based or RMS detection and optional lookahead and stereo linking.

Feed-forward stereo compressor with peak or rms detection (defaults to peak), settable attack, release, threshold, ratio and knee. Optional lookahead. There is also a method for link the signal detection of the stereo channels, by default they are linked. If you set the ratio to a value greater than 40 the compressor will act as a limiter.

Member Function Documentation

◆ ch()

pdsp::Patchable & pdsp::Compressor::ch ( size_t  index)

Uses the selected channel as input/output for the patching operation. 0 is for the left channel (default input/output) and 1 is for the right channel. Index values outside of range are remapped to 0 or 1.

Parameters
[in]indexchannel index

◆ digital()

void pdsp::Compressor::digital ( bool  lookahead = false)

sets the envelope follower behavior digital (more responsive, default behavior). Optional boolean value for activating the lookahead function (false by default).

Parameters
[in]lookaheadactivates the lookahead function

◆ RMS()

void pdsp::Compressor::RMS ( float  window_ms = 50.0f)

sets the ms window for the RMS detector and activates RMS detection mode

Parameters
[in]window_mswindow milliseconds for detection. 50ms if not given.

◆ stereoLink()

void pdsp::Compressor::stereoLink ( bool  active)

links the signal detection for stereo channels. Activated by default.

Parameters
[in]activeactivate the stereo link

The documentation for this class was generated from the following files: