-
Notifications
You must be signed in to change notification settings - Fork 0
/
fundamental.ck
57 lines (50 loc) · 1.16 KB
/
fundamental.ck
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
// Snare Fundamental Generator
public class Fundamental
{
SinOsc s => ADSR e => Gain g; //N2S: is there a better way to route this in for post processing?
//INIT VALUES
200.0 => float fundamentalPitch;
0.9 => float fundamentalGain;
30::ms => dur holdTime;
50::ms => dur releaseTime;
0::ms => dur attackTime;
attackTime => dur decayTime;
1.0 => float sustainLevel;
fun void setPitch(float pitch)
{
pitch => fundamentalPitch;
}
fun void setAHDSR(dur attack, dur hold, dur decay, float sustain, dur release)
{
attack => attackTime;
hold => holdTime;
decay => decayTime;
sustain => sustainLevel;
release => releaseTime;
}
fun void setGain(float gain)
{
gain => fundamentalGain;
}
fun void strikeSnare()
{
fundamentalGain => g.gain;
fundamentalPitch => s.freq;
(attackTime, decayTime, sustainLevel, releaseTime) => e.set;
1 => e.keyOn;
holdTime => now;
1 => e.keyOff;
500::ms => now;
}
fun void flam()
{
setPitch((fundamentalPitch * Math.random2(2,5)));
holdTime * 2 => now;
strikeSnare();
releaseTime => now;
}
fun void connect(UGen ugen)
{
g => ugen;
}
}