Krotos Modules 3
Loading...
Searching...
No Matches
krotos::MoogVcf Class Reference

Apply the Moog voltage controlled filter to an audio signal. More...

#include <MoogVcf.h>

Public Member Functions

void setUpFirst (double sampleRate, int)
 setUpFirst
 
float getSr ()
 getSr()
 
void updateCutoff (float _f0)
 updateCutoff
 
void updateResonance (float _r)
 updateResonance
 
float process (float inputSampleNow, float inputSampleBefore)
 process()
 

Private Attributes

const float initialF = 20.0f
 
float m_sr
 
float om0 = tau * initialF
 Resonant filter frequency.
 
float om0New
 
float r = 0.0f
 Feedback coefficient.
 
float rNew
 
float k
 Time step.
 
float A0P
 
float A0PNew
 
float A0M
 
float A1
 
float A1New
 
float A3
 
float A3New
 
float xf [4] = {0.0}
 

Static Private Attributes

static constexpr float tau = 2.0f * 3.1415926535f
 

Detailed Description

Apply the Moog voltage controlled filter to an audio signal.

This class implements a virtual analogue model of the Moog VCF. The system of equations describing the state of the capacitors of the electrical circuit are solved for each input sample using the Trapezoid Integration Rule. The structure is modified to fit into the Kwidget technology. It is robust and computationally efficient.

TODO: Try and emulate the non linear version...

Member Function Documentation

◆ getSr()

float krotos::MoogVcf::getSr ( )
inline

getSr()

Returns the sampleRate value in float.

◆ process()

float krotos::MoogVcf::process ( float inputSampleNow,
float inputSampleBefore )
inline

process()

main filtering process - updates state and writes sample to output. For each input sample, the linear system of equations updates the values of the state vector xf and updates the parameters if they have been changed by the user.

Parameters
floatinputSampleNow: the current input sample from the buffer
floatinputSampleBefore: the former input sample from the buffer.

◆ setUpFirst()

void krotos::MoogVcf::setUpFirst ( double sampleRate,
int  )
inline

setUpFirst

Sets up sampleRate and time step k . Gets called in the Processors prepare function.

Parameters
_sampleRate
samplesPerBlock,notused.

◆ updateCutoff()

void krotos::MoogVcf::updateCutoff ( float _f0)
inline

updateCutoff

Sets filter cutoff and updates the state coefficients from the input parameter value. Gets called from the Processor's setCutoff function. To avoid loud high frequency - resonance amplitude spikes it performs a custom check and for certain cutoff - resonance pairs it readjusts the resonance, calling the updateResonace function.

Parameters
float_f0 is the cutoff frequency in Hz parameter value

◆ updateResonance()

void krotos::MoogVcf::updateResonance ( float _r)
inline

updateResonance

Sets filter resonance and updates the state coefficients from the input parameter. Gets called from the Processor's setCutoff function. It also performs check for high frequency - resonance spikes.

Parameters
float_r is the input resonance parameter value

Member Data Documentation

◆ A0M

float krotos::MoogVcf::A0M
private

◆ A0P

float krotos::MoogVcf::A0P
private

◆ A0PNew

float krotos::MoogVcf::A0PNew
private

◆ A1

float krotos::MoogVcf::A1
private

◆ A1New

float krotos::MoogVcf::A1New
private

◆ A3

float krotos::MoogVcf::A3
private

◆ A3New

float krotos::MoogVcf::A3New
private

◆ initialF

const float krotos::MoogVcf::initialF = 20.0f
private

◆ k

float krotos::MoogVcf::k
private

Time step.

◆ m_sr

float krotos::MoogVcf::m_sr
private

◆ om0

float krotos::MoogVcf::om0 = tau * initialF
private

Resonant filter frequency.

◆ om0New

float krotos::MoogVcf::om0New
private

◆ r

float krotos::MoogVcf::r = 0.0f
private

Feedback coefficient.

◆ rNew

float krotos::MoogVcf::rNew
private

◆ tau

float krotos::MoogVcf::tau = 2.0f * 3.1415926535f
staticconstexprprivate

◆ xf

float krotos::MoogVcf::xf[4] = {0.0}
private

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