Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::LadderFilterT< SampleType > Class Template Reference

#include <ladder_filter.hpp>

Public Member Functions

void set_sample_rate (SampleType sr)
void set_frequency (SampleType hz)
void set_resonance (SampleType r)
SampleType process (SampleType input)
 Process one sample with the default saturator (see LadderSaturation).
SampleType process_reference (SampleType input)
 Process one sample with exact std::tanh stages.
SampleType process_realtime_efficient (SampleType input)
 Process one sample with the Padé FastMath::tanh stages.
void process (SampleType *buffer, int num_samples)
 Process a buffer in place with the default saturator.
void process_reference (SampleType *buffer, std::size_t num_samples)
 Process a buffer in place with exact std::tanh stages.
void process_realtime_efficient (SampleType *buffer, std::size_t num_samples)
 Process a buffer in place with the Padé FastMath::tanh stages.
void reset ()

Static Public Member Functions

static SampleType stage_coefficient (SampleType cutoff_hz, SampleType sample_rate)
 One-pole stage coefficient for a cutoff and sample rate: g = 1 - exp(-2 pi fc / fs).
template<LadderSaturation Saturation>
static SampleType saturate (SampleType x)
 Saturating non-linearity.

Member Function Documentation

◆ process() [1/2]

template<typename SampleType = float>
void pulp::signal::LadderFilterT< SampleType >::process ( SampleType * buffer,
int num_samples )
inline

Process a buffer in place with the default saturator.

◆ process() [2/2]

template<typename SampleType = float>
SampleType pulp::signal::LadderFilterT< SampleType >::process ( SampleType input)
inline

Process one sample with the default saturator (see LadderSaturation).

◆ process_realtime_efficient() [1/2]

template<typename SampleType = float>
void pulp::signal::LadderFilterT< SampleType >::process_realtime_efficient ( SampleType * buffer,
std::size_t num_samples )
inline

Process a buffer in place with the Padé FastMath::tanh stages.

◆ process_realtime_efficient() [2/2]

template<typename SampleType = float>
SampleType pulp::signal::LadderFilterT< SampleType >::process_realtime_efficient ( SampleType input)
inline

Process one sample with the Padé FastMath::tanh stages.

◆ process_reference() [1/2]

template<typename SampleType = float>
void pulp::signal::LadderFilterT< SampleType >::process_reference ( SampleType * buffer,
std::size_t num_samples )
inline

Process a buffer in place with exact std::tanh stages.

◆ process_reference() [2/2]

template<typename SampleType = float>
SampleType pulp::signal::LadderFilterT< SampleType >::process_reference ( SampleType input)
inline

Process one sample with exact std::tanh stages.

◆ reset()

template<typename SampleType = float>
void pulp::signal::LadderFilterT< SampleType >::reset ( )
inline

◆ saturate()

template<typename SampleType = float>
template<LadderSaturation Saturation>
SampleType pulp::signal::LadderFilterT< SampleType >::saturate ( SampleType x)
inlinestatic

Saturating non-linearity.

The float path goes through signal::ladder_tanh_profiled (see LadderSaturation in fast_math.hpp for the choices and their measured deviation from exact tanh). LadderFilterT<double> always uses libm: the float approximations do not reach double precision and it is not on a hot path.

◆ set_frequency()

template<typename SampleType = float>
void pulp::signal::LadderFilterT< SampleType >::set_frequency ( SampleType hz)
inline

◆ set_resonance()

template<typename SampleType = float>
void pulp::signal::LadderFilterT< SampleType >::set_resonance ( SampleType r)
inline

◆ set_sample_rate()

template<typename SampleType = float>
void pulp::signal::LadderFilterT< SampleType >::set_sample_rate ( SampleType sr)
inline

◆ stage_coefficient()

template<typename SampleType = float>
SampleType pulp::signal::LadderFilterT< SampleType >::stage_coefficient ( SampleType cutoff_hz,
SampleType sample_rate )
inlinestatic

One-pole stage coefficient for a cutoff and sample rate: g = 1 - exp(-2 pi fc / fs).

Each stage moves g of the way from its saturated state toward its saturated input per sample.


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