-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.pde
60 lines (46 loc) · 1.16 KB
/
notes.pde
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
float getFreq(int n) {
return pow(2, (n-49)/12f)*440f;
}
int jazzchord(int i ) {
int[] c = {
0, 4, 7, 9
};
return c[i];
}
UGen filter(SoundForm form) {
UGen osc = form.wave;
IIRFilter filt;
Oscil cutOsc;
Constant cutoff;
filt = new BandPass(form.freq, 100, out.sampleRate());
cutOsc = new Oscil(1, 200, Waves.SINE);
// offset the center value of the Oscil by 1000
cutOsc.offset.setLastValue( 1000+random(1000) );
// patch the oscil to the cutoff frequency of the filter
cutOsc.patch(filt.cutoff);
// patch the sawtooth oscil through the filter and then to the output
return osc.patch(filt);
}
UGen noiseFilter(SoundForm sf) {
IIRFilter filt = new BandPass(sf.freq, 50, out.sampleRate());
return sf.wave.patch(filt);
}
/*
SoundForm selected;
void mousePressed() {
for (int i=0; i < ss;i++)
if (forms.get(i).location.dist(new PVector(mouseX, mouseY)) <forms.get(i).r ) {
selected = forms.get(i);
break;
}
}
void mouseReleased() {
selected = null;
}
void keyPressed() {
// forms.get((int)random(forms.size())).unPatch();
}
// into draw
// if(selected != null)
// selected.location.set(mouseX,mouseY,0);
*/