sfFDN
Loading...
Searching...
No Matches
sfFDN::OnePoleFilter Class Reference

Implements a simple one pole filter with differential equation \(y(n) = b_0x(n) - a_1y(n-1)\). More...

#include <filter.h>

Inheritance diagram for sfFDN::OnePoleFilter:
[legend]
Collaboration diagram for sfFDN::OnePoleFilter:
[legend]

Public Member Functions

 OnePoleFilter (float b0=1.f, float a1=0.f)
 Constructs a one pole filter.
 
void SetPole (float pole)
 Set the pole of the filter.
 
void SetCoefficients (float b0, float a1)
 Set the coefficients of the filter.
 
void SetDecayFilter (float decay_db, float time_ms, float sample_rate)
 Set the pole of the filter to obtain an exponential decay filter.
 
void SetLowpass (float cutoff)
 Set the pole of the filter to obtain a lowpass filter with a 3dB cutoff frequency.
 
float Tick (float in)
 Input a sample in the filter and return the next output.
 
void Process (const AudioBuffer &input, AudioBuffer &output) noexcept override
 Processes a block of input samples through the filter.
 
uint32_t InputChannelCount () const override
 Returns the number of input channels supported by this processor.
 
uint32_t OutputChannelCount () const override
 Returns the number of output channels produced by this processor.
 
void Clear () override
 Clears the internal state of the processor.
 
std::unique_ptr< AudioProcessorClone () const override
 Creates a copy of the filter.
 
- Public Member Functions inherited from sfFDN::AudioProcessor

Detailed Description

Implements a simple one pole filter with differential equation \(y(n) = b_0x(n) - a_1y(n-1)\).

Member Function Documentation

◆ Clear()

void sfFDN::OnePoleFilter::Clear ( )
overridevirtual

Clears the internal state of the processor.

This function resets the internal state of the filter to zero.

Implements sfFDN::AudioProcessor.

◆ Clone()

std::unique_ptr< AudioProcessor > sfFDN::OnePoleFilter::Clone ( ) const
overridevirtual

Creates a copy of the filter.

Returns
A unique pointer to the cloned filter.

Implements sfFDN::AudioProcessor.

◆ InputChannelCount()

uint32_t sfFDN::OnePoleFilter::InputChannelCount ( ) const
overridevirtual

Returns the number of input channels supported by this processor.

Returns
The number of input channels.

Implements sfFDN::AudioProcessor.

◆ OutputChannelCount()

uint32_t sfFDN::OnePoleFilter::OutputChannelCount ( ) const
overridevirtual

Returns the number of output channels produced by this processor.

Returns
The number of output channels.

Implements sfFDN::AudioProcessor.

◆ Process()

void sfFDN::OnePoleFilter::Process ( const AudioBuffer & input,
AudioBuffer & output )
overridevirtualnoexcept

Processes a block of input samples through the filter.

Parameters
inputThe input audio buffer.
outputThe output audio buffer. The input and output buffers must have the same number of channels and sample count.

Implements sfFDN::AudioProcessor.

◆ SetCoefficients()

void sfFDN::OnePoleFilter::SetCoefficients ( float b0,
float a1 )

Set the coefficients of the filter.

Parameters
b0The feedforward coefficient.
a1The feedback coefficient.

◆ SetDecayFilter()

void sfFDN::OnePoleFilter::SetDecayFilter ( float decay_db,
float time_ms,
float sample_rate )

Set the pole of the filter to obtain an exponential decay filter.

Parameters
decay_dbThe decay in decibels.
time_msThe time in milliseconds.
sample_rateThe sample rate.

◆ SetLowpass()

void sfFDN::OnePoleFilter::SetLowpass ( float cutoff)

Set the pole of the filter to obtain a lowpass filter with a 3dB cutoff frequency.

Parameters
cutoffThe cutoff frequency, normalized between 0 and 1.

◆ SetPole()

void sfFDN::OnePoleFilter::SetPole ( float pole)

Set the pole of the filter.

Parameters
poleThe pole of the filter.

◆ Tick()

float sfFDN::OnePoleFilter::Tick ( float in)

Input a sample in the filter and return the next output.

Parameters
inThe input sample
Returns
The next output sample

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