dsplib 1.1.0
C++ DSP library for MATLAB-like coding
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
dsplib::Compressor Class Reference

Dynamic range compressor. More...

#include <compressor.h>

Classes

struct  Result
 Compressor processing result. More...
 

Public Member Functions

 Compressor (int sample_rate=44100, real_t threshold=-10.0, int ratio=5, real_t knee_width=0, real_t attack_time=0.01, real_t release_time=0.2)
 Construct a new Compressor object.
 
Result process (span_real x)
 Process audio frame.
 
Result operator() (span_real x)
 Process audio frame, obj(x) syntax.
 

Detailed Description

Dynamic range compressor.

See also
https://www.mathworks.com/help/audio/ref/compressor-system-object.html
Todo:
Add makeup gain

Constructor & Destructor Documentation

◆ Compressor()

dsplib::Compressor::Compressor ( int  sample_rate = 44100,
real_t  threshold = -10.0,
int  ratio = 5,
real_t  knee_width = 0,
real_t  attack_time = 0.01,
real_t  release_time = 0.2 
)
inlineexplicit

Construct a new Compressor object.

Parameters
sample_rateInput sample rate (Hz)
thresholdthe level (dB) above which gain is applied to the input signal.
ratiothe input/output ratio for signals that overshoot the operation threshold (>=1).
knee_widththe transition area in the compression characteristic.
attack_timethe time (sec) it takes the compressor gain to rise from 10% to 90% of its final value when the input goes above the threshold.
release_timethe time (sec) it takes the compressor gain to drop from 90% to 10% of its final value when the input goes below the threshold.

Member Function Documentation

◆ operator()()

Process audio frame, obj(x) syntax.

See also
process

◆ process()

Result dsplib::Compressor::process ( span_real  x)
inline

Process audio frame.

Parameters
x[in] Input audio frame
Returns
Result [out] Output pair processed and gain

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