Gin
Loading...
Searching...
No Matches
Biquad Struct Reference

Single RBJ biquad, per sample. More...

#include <gin_biquad.h>

Public Member Functions

void setLowpass (double freq, double q, double sampleRate)
void setHighpass (double freq, double q, double sampleRate)
void setBandpass (double freq, double q, double sampleRate)
void setPeak (double freq, double q, double gainDb, double sampleRate)
 Peaking EQ.
void setBypass ()
 Passes everything through unchanged.
float process (float x)
void reset ()

Public Attributes

float b0 = 1.0f
float b1 = 0.0f
float b2 = 0.0f
float a1 = 0.0f
float a2 = 0.0f
float x1 = 0.0f
float x2 = 0.0f
float y1 = 0.0f
float y2 = 0.0f

Detailed Description

Single RBJ biquad, per sample.

A small, self contained second order section for the places a filter is part of an algorithm rather than a thing the user configures - detector paths, side chain shaping, band limiting inside an effect. Filter is the one to reach for when a plugin exposes a filter to the user: it handles channels, slopes and modulation. This one is a struct with five coefficients and four state variables, and can sit inside a loop.

Coefficients follow Robert Bristow-Johnson's cookbook.

Usage:

Biquad hp;
hp.setHighpass (80.0f, 0.707f, sampleRate);
for (int i = 0; i < numSamples; i++)
data[i] = hp.process (data[i]);
Single RBJ biquad, per sample.
Definition gin_biquad.h:43
float process(float x)
Definition gin_biquad.h:100
void setHighpass(double freq, double q, double sampleRate)
Definition gin_biquad.h:56

Note: one instance holds the state for one channel.

See also
Filter, EQ

Member Function Documentation

◆ setLowpass()

void Biquad::setLowpass ( double freq,
double q,
double sampleRate )

◆ setHighpass()

void Biquad::setHighpass ( double freq,
double q,
double sampleRate )

◆ setBandpass()

void Biquad::setBandpass ( double freq,
double q,
double sampleRate )

◆ setPeak()

void Biquad::setPeak ( double freq,
double q,
double gainDb,
double sampleRate )

Peaking EQ.

Positive gainDb boosts around freq, negative cuts.

◆ setBypass()

void Biquad::setBypass ( )

Passes everything through unchanged.

◆ process()

float Biquad::process ( float x)

References a1, a2, b0, b1, b2, x1, x2, y1, and y2.

◆ reset()

void Biquad::reset ( )

References x1, x2, y1, and y2.

Member Data Documentation

◆ b0

float Biquad::b0 = 1.0f

Referenced by process().

◆ b1

float Biquad::b1 = 0.0f

Referenced by process().

◆ b2

float Biquad::b2 = 0.0f

Referenced by process().

◆ a1

float Biquad::a1 = 0.0f

Referenced by process().

◆ a2

float Biquad::a2 = 0.0f

Referenced by process().

◆ x1

float Biquad::x1 = 0.0f

Referenced by process(), and reset().

◆ x2

float Biquad::x2 = 0.0f

Referenced by process(), and reset().

◆ y1

float Biquad::y1 = 0.0f

Referenced by process(), and reset().

◆ y2

float Biquad::y2 = 0.0f

Referenced by process(), and reset().


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