Skip to content

Class daisysp::Compressor

ClassList > daisysp > Compressor

More...

  • #include <compressor.h>

Public Functions

Type Name
float Apply (float in)
void AutoMakeup (bool enable)
Compressor ()
float GetAttack ()
float GetGain ()
float GetMakeup ()
float GetRatio ()
float GetRelease ()
float GetThreshold ()
void Init (float sample_rate)
float Process (float in)
float Process (float in, float key)
void ProcessBlock (float * in, float * out, size_t size)
void ProcessBlock (float * in, float * out, float * key, size_t size)
void ProcessBlock (float ** in, float ** out, float * key, size_t channels, size_t size)
void SetAttack (float attack)
void SetMakeup (float gain)
void SetRatio (float ratio)
void SetRelease (float release)
void SetThreshold (float threshold)
~Compressor ()

Detailed Description

dynamics compressor

influenced by compressor in soundpipe (from faust).

Modifications made to do: * Less calculations during each process loop (coefficients recalculated on parameter change). * C++-ified * added sidechain support * pulled gain apart for monitoring and multichannel support * improved readability * improved makeup-gain calculations * changing controls now costs a lot less * a lot less expensive

by: shensley, improved upon by AvAars

Todo

Add soft/hard knee settings

Public Functions Documentation

function Apply

inline float daisysp::Compressor::Apply (
    float in
) 

Apply compression to the audio signal, based on the previously calculated gain

Parameters:

  • in audio input signal

function AutoMakeup

inline void daisysp::Compressor::AutoMakeup (
    bool enable
) 

Enables or disables the automatic makeup gain. Disabling sets the makeup gain to 0.0

Parameters:

  • enable true to enable, false to disable

function Compressor

inline daisysp::Compressor::Compressor () 

function GetAttack

inline float daisysp::Compressor::GetAttack () 

Gets the envelope time for onset of compression


function GetGain

inline float daisysp::Compressor::GetGain () 

Gets the gain reduction in dB


function GetMakeup

inline float daisysp::Compressor::GetMakeup () 

Gets the additional gain to make up for the compression


function GetRatio

inline float daisysp::Compressor::GetRatio () 

Gets the amount of gain reduction


function GetRelease

inline float daisysp::Compressor::GetRelease () 

Gets the envelope time for release of compression


function GetThreshold

inline float daisysp::Compressor::GetThreshold () 

Gets the threshold in dB


function Init

void daisysp::Compressor::Init (
    float sample_rate
) 

Initializes compressor

Parameters:

  • sample_rate rate at which samples will be produced by the audio engine.

function Process [½]

float daisysp::Compressor::Process (
    float in
) 

Compress the audio input signal, saves the calculated gain

Parameters:

  • in audio input signal

function Process [2/2]

inline float daisysp::Compressor::Process (
    float in,
    float key
) 

Compresses the audio input signal, keyed by a secondary input.

Parameters:

  • in audio input signal (to be compressed)
  • key audio input that will be used to side-chain the compressor

function ProcessBlock [⅓]

inline void daisysp::Compressor::ProcessBlock (
    float * in,
    float * out,
    size_t size
) 

Compresses a block of audio

Parameters:

  • in audio input signal
  • out audio output signal
  • size the size of the block

function ProcessBlock [⅔]

void daisysp::Compressor::ProcessBlock (
    float * in,
    float * out,
    float * key,
    size_t size
) 

Compresses a block of audio, keyed by a secondary input

Parameters:

  • in audio input signal (to be compressed)
  • out audio output signal
  • key audio input that will be used to side-chain the compressor
  • size the size of the block

function ProcessBlock [3/3]

void daisysp::Compressor::ProcessBlock (
    float ** in,
    float ** out,
    float * key,
    size_t channels,
    size_t size
) 

Compresses a block of multiple channels of audio, keyed by a secondary input

Parameters:

  • in audio input signals (to be compressed)
  • out audio output signals
  • key audio input that will be used to side-chain the compressor
  • channels the number of audio channels
  • size the size of the block

function SetAttack

inline void daisysp::Compressor::SetAttack (
    float attack
) 

Sets the envelope time for onset of compression for signals above the threshold.

Parameters:

  • attack Expects 0.001 -> 10

function SetMakeup

inline void daisysp::Compressor::SetMakeup (
    float gain
) 

Manually sets the additional gain to make up for the compression

Parameters:

  • gain Expects 0.0 -> 80

function SetRatio

inline void daisysp::Compressor::SetRatio (
    float ratio
) 

Sets the amount of gain reduction applied to compressed signals

Parameters:

  • ratio Expects 1.0 -> 40. (untested with values < 1.0)

function SetRelease

inline void daisysp::Compressor::SetRelease (
    float release
) 

Sets the envelope time for release of compression as input signal falls below threshold.

Parameters:

  • release Expects 0.001 -> 10

function SetThreshold

inline void daisysp::Compressor::SetThreshold (
    float threshold
) 

Sets the threshold in dB at which compression will be applied

Parameters:

  • threshold Expects 0.0 -> -80.

function ~Compressor

inline daisysp::Compressor::~Compressor () 


The documentation for this class was generated from the following file external-docs/DaisySP/DaisySP-LGPL/Source/Dynamics/compressor.h