-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathob6-experiments.scd
111 lines (94 loc) · 1.98 KB
/
ob6-experiments.scd
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
MIDIClient.init;
MIDIIn.connectAll;
~ob6 = MIDIOut.newByName("OB-6", "OB-6");
~ob6.latency = 0;
// ~ob6.latency = Server.default.latency;
(
p = Pbind(
\type, \midi,
\midicmd, \noteOn,
\midiout, ~ob6,
\chan, 0,
\degree, Pwhite(-7, 12, inf),
\dur, Pwrand([0.25, Pn(0.125, 2)], #[0.8, 0.2], inf),
\legato, sin(Ptime(inf) * 0.5).linexp(-1, 1, 1/10, 1),
\amp, Pexprand(0.5, 1.0, inf)
).play(quant: 1);
)
~ob6.allNotesOff(0);
(
Event.addEventType(\OB6_NRPN, {
var midiout = ~midiout.value;
var chan = ~chan.value;
var nrpnNum = ~nrpnNum.value;
var nrpnValue = ~nrpnValue.value;
if (nrpnValue.class == String) {
if (nrpnValue.beginsWith("c")) {
nrpnValue = Bus.new('control', nrpnValue[1..].asInteger, 1, s).getSynchronous();
};
};
nrpnValue = nrpnValue.asInteger;
midiout.control(chan, 0x63, nrpnNum >> 7);
midiout.control(chan, 0x62, nrpnNum & 0x7F);
midiout.control(chan, 0x06, nrpnValue >> 7);
midiout.control(chan, 0x26, nrpnValue & 0x7F);
});
)
// randomize filter cutoff
(
p = Pbind(
\type, \OB6_NRPN,
\midiout, ~ob6,
\chan, 0,
\nrpnNum, 45,
\nrpnValue, Pwhite(0, 164),
\dur, 1
).play(quant: 1);
)
// randomize filter cutoff with a LFO from a Node bus
(
p = Pbind(
\type, \OB6_NRPN,
\midiout, ~ob6,
\chan, 0,
\nrpnNum, 45,
\nrpnValue, Ndef(\bla, { SinOsc.kr(1/10).range(0,164) }).asMap,
\dur, 0.1
).play(quant: 1);
)
// do crazy stuff
(
p = Pbind(
\type, \OB6_NRPN,
\midiout, ~ob6,
\chan, 0,
\nrpnNum, Pwhite(0, 150),
\nrpnValue, Pwhite(0,255),
\dur, 1
).play(quant: 1);
)
// old style sequencer
~root = 40;
~dur = 0.1;
~velocity = 60;
(
MIDIFunc.cc({ |value, cc, chan|
postf("% % %\n", value, cc, chan);
switch(chan,
0, { ~root = value.linlin(0, 127, 0, 70) },
1, { ~dur = value.linexp(0, 127, 0.01, 2) },
2, { ~velocity = value.linlin(0, 127, 0, 127) }
);
}, 7);
)
(
r = Routine({
loop {
(type: \midi, midiout: ~ob6, degree: [0, 2, 4, 7].choose, root: ~root, amp: ~velocity / 127, dur: ~dur).play;
~dur.wait;
}
});
)
r.play
r.stop
~ob6.allNotesOff(0)