NAP
Public Types | Public Member Functions | Public Attributes | List of all members
FilterNode Class Reference

#include <audio/node/filternode.h>

Public Types

enum  EMode {
  LowPass, HighPass, BandPass, LowRes,
  HighRes
}
 

Public Member Functions

 FilterNode (NodeManager &nodeManager)
 
void process () override
 
void prepare (ControllerValue frequency, ControllerValue resonanceBand, ControllerValue gain)
 
void setMode (EMode mode)
 
void setFrequency (ControllerValue cutoffFrequency)
 
void setResonance (ControllerValue resonance)
 
void setBand (ControllerValue band)
 
void setGain (ControllerValue gain)
 
EMode getMode () const
 
ControllerValue getFrequency () const
 
ControllerValue getResonance () const
 
ControllerValue getBand () const
 
ControllerValue getGain () const
 
- Public Member Functions inherited from Node
 Node (NodeManager &manager)
 
const std::set< OutputPin * > & getOutputs () const
 
const std::set< InputPinBase * > & getInputs () const
 
- Public Member Functions inherited from Process
 Process (NodeManager &nodeManager)
 
 Process (ParentProcess &parent)
 
 Process (const Process &)=delete
 
Processoperator= (const Process &)=delete
 
virtual ~Process ()
 
void update ()
 
NodeManagergetNodeManager () const
 
int getBufferSize () const
 
float getSampleRate () const
 
DiscreteTimeValue getSampleTime () const
 

Public Attributes

InputPin audioInput = {this}
 
OutputPin audioOutput = {this}
 

Additional Inherited Members

- Protected Member Functions inherited from Node
SampleBuffergetOutputBuffer (OutputPin &output)
 
- Protected Member Functions inherited from Process
virtual void sampleRateChanged (float sampleRate)
 
virtual void bufferSizeChanged (int bufferSize)
 
bool isRegisteredWithNodeManager () const
 

Description

Multi-purpose DSP filter using the Butterworth filter algorithm to calculate biquad coefficients. Is able to apply lowpass and highpass with or without variable resonance peak and bandpass filtering.

Inheritance diagram for FilterNode:
[legend]
Collaboration diagram for FilterNode:
[legend]

Member Enumeration Documentation

◆ EMode

enum EMode
strong
Enumerator
LowPass 
HighPass 
BandPass 
LowRes 
HighRes 

Constructor & Destructor Documentation

◆ FilterNode()

FilterNode ( NodeManager nodeManager)

Member Function Documentation

◆ getBand()

ControllerValue getBand ( ) const
Returns
the bandwidth in Hz for bandpass filtering.

◆ getFrequency()

ControllerValue getFrequency ( ) const
Returns
the cutoff frequency (for highpass and lowpass filters) or the center frequency (for bandpass filters) in Hz.

◆ getGain()

ControllerValue getGain ( ) const
Returns
the output gain factor of the filter.

◆ getMode()

EMode getMode ( ) const
Returns
the mode of the filter.

◆ getResonance()

ControllerValue getResonance ( ) const
Returns
the resonance peak for resonating low- and highpass filtering.

◆ prepare()

void prepare ( ControllerValue  frequency,
ControllerValue  resonanceBand,
ControllerValue  gain 
)

Immediately changes the settings of the filter. Only call this before the filter starts being processed.

Parameters
frequencycutoff frequency of the filter in Hz
resonanceBandIn case of LowRes or HighRes: Resonance value. 0 means no resonance, 30 means self-oscillation. In case of bandpass: bandwith in herz.
gainthe gaining factor of the filter output

◆ process()

void process ( )
overridevirtual

Has to be overwritted by descendants to specify the actual process.

Reimplemented from Node.

◆ setBand()

void setBand ( ControllerValue  band)

Sets the bandwith for bandpass filtering in Hz.

◆ setFrequency()

void setFrequency ( ControllerValue  cutoffFrequency)

Sets the frequency parameter of the filter in Hz. For the different modes this means:

  • Cutoff frequency for highpass and lowpass filters
  • Center frequency for bandpass filtering

◆ setGain()

void setGain ( ControllerValue  gain)

Sets the gaining factor of the filter's output.

◆ setMode()

void setMode ( EMode  mode)

Sets the mode of the filter.

Parameters
modelowpass, highpass, bandpass, lowpass with resonance peak or highpass with resonance peak.

◆ setResonance()

void setResonance ( ControllerValue  resonance)

Sets the resonance peak of the filter. 0 means no resonance, 30 means self-oscillation.

Member Data Documentation

◆ audioInput

InputPin audioInput = {this}

The input to be filtered

◆ audioOutput

OutputPin audioOutput = {this}

Outputs the filtered signal