MostlyHarmless 0.0.1
 
Loading...
Searching...
No Matches
marvin::dsp::filters::SVF< SampleType > Class Template Reference

A TPT State Variable Filter, based on the structure from Vadim Zavalishin's The Art of VA Filter Design More...

#include <marvin_SVF.h>

Public Types

enum class  FilterType {
  Highpass , Bandpass , Lowpass , NormalisedBandpass ,
  BandShelf , LowShelf , HighShelf , Notch ,
  Allpass
}
 

Public Member Functions

void initialise (double sampleRate)
 
void setFrequency (SampleType newFrequency)
 
void setResonance (SampleType newResonance)
 
void setGainDb (SampleType newGainDb)
 
SVFResult< SampleType > operator() (SampleType x)
 
SampleType operator() (FilterType type, SampleType x)
 
void reset ()
 

Detailed Description

template<FloatType SampleType>
class marvin::dsp::filters::SVF< SampleType >

A TPT State Variable Filter, based on the structure from Vadim Zavalishin's The Art of VA Filter Design

Member Enumeration Documentation

◆ FilterType

template<FloatType SampleType>
enum class marvin::dsp::filters::SVF::FilterType
strong

Represents the available filter types the SVF can process.

Enumerator
Highpass 
Bandpass 
Lowpass 
NormalisedBandpass 
BandShelf 
LowShelf 
HighShelf 
Notch 
Allpass 

Member Function Documentation

◆ initialise()

template<FloatType SampleType>
void marvin::dsp::filters::SVF< SampleType >::initialise ( double sampleRate)

Initialises the filter. This must be called before calling setFrequency() or operator().

Parameters
sampleRateThe sample rate the filter should process at.

◆ operator()() [1/2]

template<FloatType SampleType>
SampleType marvin::dsp::filters::SVF< SampleType >::operator() ( FilterType type,
SampleType x )
nodiscard

Processes a sample through the filter, with a single given filter type.

Parameters
typeThe FilterType to use.
xThe sample to process.
Returns
The filtered sample.

◆ operator()() [2/2]

template<FloatType SampleType>
SVFResult< SampleType > marvin::dsp::filters::SVF< SampleType >::operator() ( SampleType x)
nodiscard

Processes a sample through the filter, and returns the input filtered through each filter type (with an SVF this is relatively cheap, and allows for custom switching algorithms on the user side).

Parameters
xThe sample to process.
Returns
An SVFResult<SampleType> containing the filtered results for each filter type.

◆ reset()

template<FloatType SampleType>
void marvin::dsp::filters::SVF< SampleType >::reset ( )

Resets the filter to its initial state.

◆ setFrequency()

template<FloatType SampleType>
void marvin::dsp::filters::SVF< SampleType >::setFrequency ( SampleType newFrequency)

Sets the cutoff frequency of the filter.

Parameters
newFrequencyThe new filter cutoff in Hz.

◆ setGainDb()

template<FloatType SampleType>
void marvin::dsp::filters::SVF< SampleType >::setGainDb ( SampleType newGainDb)

Sets the gain in dB for the bandshelf, lowshelf and highshelf taps. Ignored in the other filter paths.

Parameters
newGainDbThe new gain in dB.

◆ setResonance()

template<FloatType SampleType>
void marvin::dsp::filters::SVF< SampleType >::setResonance ( SampleType newResonance)

Sets the resonance of the filter directly - a value of 1 achieves self oscillation, a value of 0 is no resonance.

Parameters
newResonanceThe new filter resonance, between 0 and 1.

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