]> git.bts.cx Git - benzene.git/blob - third_party/soloud_speech/resonator.h
Sprites
[benzene.git] / third_party / soloud_speech / resonator.h
1 #ifndef RESONATOR_H
2 #define RESONATOR_H
3
4 class resonator
5 {
6 float mA, mB, mC, mP1, mP2;
7 public:
8
9 /* Convert formant freqencies and bandwidth into resonator difference equation coefficents
10 */
11 void initResonator(
12 int aFrequency, /* Frequency of resonator in Hz */
13 int aBandwidth, /* Bandwidth of resonator in Hz */
14 int aSamplerate);
15
16 /* Convert formant freqencies and bandwidth into anti-resonator difference equation constants
17 */
18 void initAntiresonator(
19 int aFrequency, /* Frequency of resonator in Hz */
20 int aBandwidth, /* Bandwidth of resonator in Hz */
21 int aSamplerate);
22
23 /* Set gain */
24 void setGain(float aG);
25
26 /* Generic resonator function */
27 float resonate(float input);
28
29 /* Generic anti-resonator function
30 Same as resonator except that a,b,c need to be set with initAntiresonator()
31 and we save inputs in p1/p2 rather than outputs.
32 There is currently only one of these - "mNasalZero"
33
34 Output = (mNasalZero.a * input) + (mNasalZero.b * oldin1) + (mNasalZero.c * oldin2)
35 */
36
37 float antiresonate(float input);
38
39 resonator();
40
41 ~resonator();
42 };
43
44 #endif