DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::AnalogSection Struct Reference

A first or second order analog section, in radians per second: (b2 s^2 + b1 s + b0) / (a2 s^2 + a1 s + a0). More...

#include <FilterDesign.h>

Public Member Functions

double magnitudeSquared (double omega) const noexcept
 Squared magnitude at an angular frequency (rad/s).
 
double magnitudeDb (double hz) const noexcept
 Magnitude in decibels at a frequency in hertz.
 
bool isSecondOrder () const noexcept
 Whether the denominator is of second order.
 
double poleFrequency () const noexcept
 The frequency of the poles, in hertz (the corner of a first-order section).
 

Static Public Member Functions

static AnalogSection lowPass (double hz, double q=0.7071067811865476) noexcept
 Second-order low-pass, gain Q at the corner.
 
static AnalogSection highPass (double hz, double q=0.7071067811865476) noexcept
 Second-order high-pass, gain Q at the corner.
 
static AnalogSection bandPass (double hz, double q=0.7071067811865476) noexcept
 Band-pass, 0 dB at the centre.
 
static AnalogSection notch (double hz, double q=0.7071067811865476) noexcept
 Notch at the centre, 0 dB away from it.
 
static AnalogSection allPass (double hz, double q=0.7071067811865476) noexcept
 Second-order all-pass (the magnitude is 1; only the phase turns).
 
static AnalogSection peak (double hz, double q, double gainDb) noexcept
 Bell: gainDb at the centre, bandwidth hz / Q at half that gain in decibels.
 
static AnalogSection lowShelf (double hz, double gainDb, double slope=1.0) noexcept
 Second-order low shelf: gainDb below the corner, half of it (in decibels) at the corner.
 
static AnalogSection highShelf (double hz, double gainDb, double slope=1.0) noexcept
 Second-order high shelf: gainDb above the corner, half of it (in decibels) at the corner.
 
static AnalogSection lowShelfQ (double hz, double gainDb, double q) noexcept
 Second-order low shelf by its Q: gainDb below the corner, half of it (in decibels) at the corner whatever the Q. At 0.7071 it is lowShelf() at a slope of 1; above, the response rises over the plateau before the corner and dips under 0 dB after it, more the higher the Q; a cut is the exact inverse of the boost.
 
static AnalogSection highShelfQ (double hz, double gainDb, double q) noexcept
 Second-order high shelf by its Q: lowShelfQ() mirrored about the corner.
 
static AnalogSection tiltSecondOrder (double hz, double gainDb, double q=0.7071067811865476) noexcept
 Second-order tilt: 0 dB at the pivot, half of gainDb down far below it and half of it up far above, 12 dB per octave at most on the way; the Q as in lowShelfQ().
 
static AnalogSection firstOrderLowPass (double hz) noexcept
 First-order low-pass, -3 dB at the corner.
 
static AnalogSection firstOrderHighPass (double hz) noexcept
 First-order high-pass, -3 dB at the corner.
 
static AnalogSection firstOrderLowShelf (double hz, double gainDb) noexcept
 First-order low shelf: gainDb at DC, half of it (in decibels) at the corner.
 
static AnalogSection firstOrderHighShelf (double hz, double gainDb) noexcept
 First-order high shelf: gainDb at the top, half of it (in decibels) at the corner.
 
static AnalogSection tilt (double hz, double gainDb) noexcept
 First-order tilt: 0 dB at the pivot, half of gainDb down far below it and half of it up far above.
 
static AnalogSection make (double b2, double b1, double b0, double a2, double a1, double a0) noexcept
 Builds a section from its six coefficients.
 

Public Attributes

double b2 = 0.0
 
double b1 = 0.0
 
double b0 = 1.0
 
double a2 = 0.0
 
double a1 = 0.0
 
double a0 = 1.0
 

Detailed Description

A first or second order analog section, in radians per second: (b2 s^2 + b1 s + b0) / (a2 s^2 + a1 s + a0).

Definition at line 69 of file FilterDesign.h.

Member Function Documentation

◆ allPass()

static AnalogSection dspark::AnalogSection::allPass ( double  hz,
double  q = 0.7071067811865476 
)
inlinestaticnoexcept

Second-order all-pass (the magnitude is 1; only the phase turns).

Definition at line 130 of file FilterDesign.h.

◆ bandPass()

static AnalogSection dspark::AnalogSection::bandPass ( double  hz,
double  q = 0.7071067811865476 
)
inlinestaticnoexcept

Band-pass, 0 dB at the centre.

Definition at line 116 of file FilterDesign.h.

◆ firstOrderHighPass()

static AnalogSection dspark::AnalogSection::firstOrderHighPass ( double  hz)
inlinestaticnoexcept

First-order high-pass, -3 dB at the corner.

Definition at line 197 of file FilterDesign.h.

◆ firstOrderHighShelf()

static AnalogSection dspark::AnalogSection::firstOrderHighShelf ( double  hz,
double  gainDb 
)
inlinestaticnoexcept

First-order high shelf: gainDb at the top, half of it (in decibels) at the corner.

Definition at line 211 of file FilterDesign.h.

◆ firstOrderLowPass()

static AnalogSection dspark::AnalogSection::firstOrderLowPass ( double  hz)
inlinestaticnoexcept

First-order low-pass, -3 dB at the corner.

Definition at line 190 of file FilterDesign.h.

◆ firstOrderLowShelf()

static AnalogSection dspark::AnalogSection::firstOrderLowShelf ( double  hz,
double  gainDb 
)
inlinestaticnoexcept

First-order low shelf: gainDb at DC, half of it (in decibels) at the corner.

Definition at line 204 of file FilterDesign.h.

◆ highPass()

static AnalogSection dspark::AnalogSection::highPass ( double  hz,
double  q = 0.7071067811865476 
)
inlinestaticnoexcept

Second-order high-pass, gain Q at the corner.

Definition at line 109 of file FilterDesign.h.

◆ highShelf()

static AnalogSection dspark::AnalogSection::highShelf ( double  hz,
double  gainDb,
double  slope = 1.0 
)
inlinestaticnoexcept

Second-order high shelf: gainDb above the corner, half of it (in decibels) at the corner.

Definition at line 151 of file FilterDesign.h.

◆ highShelfQ()

static AnalogSection dspark::AnalogSection::highShelfQ ( double  hz,
double  gainDb,
double  q 
)
inlinestaticnoexcept

Second-order high shelf by its Q: lowShelfQ() mirrored about the corner.

Definition at line 171 of file FilterDesign.h.

◆ isSecondOrder()

bool dspark::AnalogSection::isSecondOrder ( ) const
inlinenoexcept

Whether the denominator is of second order.

Definition at line 90 of file FilterDesign.h.

◆ lowPass()

static AnalogSection dspark::AnalogSection::lowPass ( double  hz,
double  q = 0.7071067811865476 
)
inlinestaticnoexcept

Second-order low-pass, gain Q at the corner.

Definition at line 102 of file FilterDesign.h.

◆ lowShelf()

static AnalogSection dspark::AnalogSection::lowShelf ( double  hz,
double  gainDb,
double  slope = 1.0 
)
inlinestaticnoexcept

Second-order low shelf: gainDb below the corner, half of it (in decibels) at the corner.

Definition at line 144 of file FilterDesign.h.

◆ lowShelfQ()

static AnalogSection dspark::AnalogSection::lowShelfQ ( double  hz,
double  gainDb,
double  q 
)
inlinestaticnoexcept

Second-order low shelf by its Q: gainDb below the corner, half of it (in decibels) at the corner whatever the Q. At 0.7071 it is lowShelf() at a slope of 1; above, the response rises over the plateau before the corner and dips under 0 dB after it, more the higher the Q; a cut is the exact inverse of the boost.

Definition at line 164 of file FilterDesign.h.

◆ magnitudeDb()

double dspark::AnalogSection::magnitudeDb ( double  hz) const
inlinenoexcept

Magnitude in decibels at a frequency in hertz.

Definition at line 84 of file FilterDesign.h.

◆ magnitudeSquared()

double dspark::AnalogSection::magnitudeSquared ( double  omega) const
inlinenoexcept

Squared magnitude at an angular frequency (rad/s).

Definition at line 75 of file FilterDesign.h.

◆ make()

static AnalogSection dspark::AnalogSection::make ( double  b2,
double  b1,
double  b0,
double  a2,
double  a1,
double  a0 
)
inlinestaticnoexcept

Builds a section from its six coefficients.

Definition at line 225 of file FilterDesign.h.

◆ notch()

static AnalogSection dspark::AnalogSection::notch ( double  hz,
double  q = 0.7071067811865476 
)
inlinestaticnoexcept

Notch at the centre, 0 dB away from it.

Definition at line 123 of file FilterDesign.h.

◆ peak()

static AnalogSection dspark::AnalogSection::peak ( double  hz,
double  q,
double  gainDb 
)
inlinestaticnoexcept

Bell: gainDb at the centre, bandwidth hz / Q at half that gain in decibels.

Definition at line 137 of file FilterDesign.h.

◆ poleFrequency()

double dspark::AnalogSection::poleFrequency ( ) const
inlinenoexcept

The frequency of the poles, in hertz (the corner of a first-order section).

Definition at line 93 of file FilterDesign.h.

◆ tilt()

static AnalogSection dspark::AnalogSection::tilt ( double  hz,
double  gainDb 
)
inlinestaticnoexcept

First-order tilt: 0 dB at the pivot, half of gainDb down far below it and half of it up far above.

Definition at line 218 of file FilterDesign.h.

◆ tiltSecondOrder()

static AnalogSection dspark::AnalogSection::tiltSecondOrder ( double  hz,
double  gainDb,
double  q = 0.7071067811865476 
)
inlinestaticnoexcept

Second-order tilt: 0 dB at the pivot, half of gainDb down far below it and half of it up far above, 12 dB per octave at most on the way; the Q as in lowShelfQ().

Definition at line 182 of file FilterDesign.h.

Member Data Documentation

◆ a0

double dspark::AnalogSection::a0 = 1.0

Definition at line 72 of file FilterDesign.h.

◆ a1

double dspark::AnalogSection::a1 = 0.0

Definition at line 72 of file FilterDesign.h.

◆ a2

double dspark::AnalogSection::a2 = 0.0

Definition at line 72 of file FilterDesign.h.

◆ b0

double dspark::AnalogSection::b0 = 1.0

Definition at line 71 of file FilterDesign.h.

◆ b1

double dspark::AnalogSection::b1 = 0.0

Definition at line 71 of file FilterDesign.h.

◆ b2

double dspark::AnalogSection::b2 = 0.0

Definition at line 71 of file FilterDesign.h.


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