miniDSP
A small C library for audio DSP
Loading...
Searching...
No Matches
biquad.h
Go to the documentation of this file.
1
20#ifndef BIQUAD_H
21#define BIQUAD_H
22
23#include <math.h>
24#include <stdlib.h>
25
26#ifndef M_LN2
27#define M_LN2 0.69314718055994530942
28#endif
29
30#ifndef M_PI
31#define M_PI 3.14159265358979323846
32#endif
33
34/* The sample type used throughout. Change to float if you want
35 * single-precision processing (saves memory, slightly less accurate). */
36typedef double smp_type;
37
47typedef struct {
48 smp_type a0, a1, a2, a3, a4; /* filter coefficients */
49 smp_type x1, x2; /* input delay line */
50 smp_type y1, y2; /* output delay line */
51} biquad;
52
57smp_type BiQuad(smp_type sample, biquad *b);
58
70biquad *BiQuad_new(int type, smp_type dbGain,
71 smp_type freq, smp_type srate,
72 smp_type bandwidth);
73
88 LPF, /* Low-pass filter */
89 HPF, /* High-pass filter */
90 BPF, /* Band-pass filter */
91 NOTCH, /* Notch filter */
92 PEQ, /* Peaking band EQ */
93 LSH, /* Low shelf filter */
94 HSH /* High shelf filter */
95};
96
97#endif /* BIQUAD_H */
smp_type BiQuad(smp_type sample, biquad *b)
Process a single sample through the filter and return the result.
Definition biquad.c:49
biquad * BiQuad_new(int type, smp_type dbGain, smp_type freq, smp_type srate, smp_type bandwidth)
Create and initialise a new biquad filter.
Definition biquad.c:88
FILT_TYPE
Filter types.
Definition biquad.h:87
State and coefficients for a single biquad filter section.
Definition biquad.h:47