1
/************************************************/
2
/* Lip Filter Object by Perry R. Cook, 1995-96 */
3
/* The lip of the brass player has dynamics */
4
/* which are controlled by the mass, spring */
5
/* constant, and damping of the lip. This */
6
/* filter simulates that behavior and the */
7
/* transmission/reflection properties as */
8
/* well. See Cook TBone and HosePlayer */
9
/* instruments and articles. */
10
/************************************************/
18
coeffs[0] = (MY_FLOAT) 0.0;
19
coeffs[1] = (MY_FLOAT) 0.0;
20
filter->setZeroCoeffs(coeffs);
29
void LipFilt :: clear()
32
lastOutput = (MY_FLOAT) 0.0;
35
void LipFilt :: setFreq(MY_FLOAT frequency)
38
coeffs[0] = (MY_FLOAT) 2.0 * (MY_FLOAT) 0.997 *
39
(MY_FLOAT) cos(TWO_PI * frequency / SRATE); /* damping should change with */
40
coeffs[1] = (MY_FLOAT) (-0.997 * 0.997); /* lip parameters, but not yet.*/
41
filter->setPoleCoeffs(coeffs);
42
filter->setGain((MY_FLOAT) 0.03);
45
/* NOTE: Here we should add lip tension */
46
/* settings based on Mass/Spring/Damping */
48
MY_FLOAT LipFilt :: tick(MY_FLOAT mouthSample,MY_FLOAT boreSample)
49
/* Perform "Table Lookup" By Polynomial Calculation */
52
temp = mouthSample - boreSample; /* Differential pressure */
53
temp = filter->tick(temp); /* Force -> position */
54
temp = temp*temp; /* Simple position to area mapping */
55
if (temp > 1.0) temp = (MY_FLOAT) 1.0; /* Saturation at + 1.0 */
56
lastOutput = temp * mouthSample; /* Assume mouth input = area */
57
lastOutput += ((MY_FLOAT) 1.0 - temp) * boreSample; /* and Bore reflection is compliment. */
61
MY_FLOAT LipFilt :: lastOut()