Repository navigation
Expand file tree
/
Copy pathtable.lib
More file actions
84 lines (65 loc) · 2.69 KB
/
Copy pathtable.lib
File metadata and controls
84 lines (65 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
declare name "Faust Tables Library";
declare author "Romain Michon";
declare version "1.0";
import("math.lib");
saturation(x) = x<: (_>1),(_<=1 : _*x) :> _+_;
saturation2(x) = x<: (_<-1),(_>=-1 : _*x) :> _*-1+_;
//*********************************************************************************
// BOW TABLE
//*********************************************************************************
bow(offset,slope) = pow(abs(sample) + 0.75, -4) : saturation
with{
sample(y) = (y + offset)*slope;
};
//*********************************************************************************
// REED TABLE
//*********************************************************************************
reed(offset,slope) = reedTable(_) : saturation : saturation2
with{
reedTable = offset + (slope*_);
};
//*********************************************************************************
// ONE ZERO FILTER
//*********************************************************************************
oneZero(x) = (_*0.5 + x*0.5)~_;
//*********************************************************************************
// BANDPASS FILTER WITH CONSTANT UNITY PEAK GAIN BASED ON A BIQUAD
//*********************************************************************************
bandPass(resonance,radius) = TF2(b0,b1,b2,a1,a2)
with{
a2 = radius*radius;
a1 = -2*radius*cos(PI*2*resonance/SR);
b0 = 0.5-0.5*a2;
b1 = 0;
b2 = -b0;
};
//*********************************************************************************
// BANDPASS FILTER BASED ON A BIQUAD
//*********************************************************************************
bandPassH(resonance,radius) = TF2(b0,b1,b2,a1,a2)
with{
a2 = radius*radius;
a1 = -2*radius*cos(PI*2*resonance/SR);
b0 = 1;
b1 = 0;
b2 = 0;
};
//*********************************************************************************
// FLUE JET NON-LINEAR FUNCTION
//*********************************************************************************
jetTable(x) = x <: _*(_*_-1) : saturation1 : saturation2
with{
saturation1(x) = x<: (_>1),(_<=1 : _*x) :> _+_;
saturation2(x) = x<: (_<-1),(_>=-1 : _*x) :> _*-1+_;
};
//*********************************************************************************
// WAVE TABLE FOR MODAL BAR INSTRUMENTS
//*********************************************************************************
marmstk1Wave(stickHardness) = rdtable(marmstk1TableSize,marmstk1,int(dataRate(rate)*gateSignal))
with{
readMarmstk1 = ffunction(float readMarmstk1 (int), <readTable.h>,"");
marmstk1TableSize = 246;
marmstk1 = time%marmstk1TableSize : int : readMarmstk1;
rate = 0.25*pow(4,stickHardness);
dataRate(readRate) = readRate : (+ : decimal) ~ _ : *(float(marmstk1TableSize));
};