-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonomeLoops.sc
More file actions
80 lines (59 loc) · 1.92 KB
/
MonomeLoops.sc
File metadata and controls
80 lines (59 loc) · 1.92 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
( // create monome and new event type
m = Monome.new("127.0.0.1", 16807);
Event.addEventType(\monomeLedEvent, { m.led(~col, ~row, ~i); {~dur.wait; m.led(~col, ~row, 0)}.fork; };);
p = Pbind(\type, \monomeLedEvent, \col, 0, \row, 0, \dur, 1, \i, 1);
)
(
m.button_func_user = {|msg|
msg.postln;
if(msg[3] == 1) {
// m.led_row(0, msg[2], [0,0,0,0,0,0,0]);
if(~bufArray[msg[2]].notNil) {
~mLEDEvents[msg[2]].stop;
~bufPlayers[msg[2]].stop;
~mLEDEvents[msg[2]] = Pbindf(p,
\col, Pseq((0..7), inf, msg[1]),
\row, msg[2],
\i, 1,
\dur, ~bufArray[msg[2]].numFrames/8/44100
).play(quant: [0.125, 0, 0]);
~bufPlayers[msg[2]] = Pmono(
\MmLP,
\out, 0,
\trig, 1,
\bufnum, ~bufArray[msg[2]],
\startPos, Pseq((0..7), inf, msg[1])*(~bufArray[msg[2]].numFrames/8),
\dur, ~bufArray[msg[2]].numFrames/8/44100
).play(quant: [0.125, 0, 0]);
}
{"Buffer is nil".postln};
}
}
)
~bufPlayers[0]
( // set up arrays
~bufArray = Array.fill(8, nil);
~mLEDEvents = Array.fill(8, nil);
~bufPlayers = Array.fill(8, nil);
)
( // fill arrays
~bufArray[0] = Buffer.read(s, "/Users/colvin/Documents/SC3/MLoopPlayer/Audio/MLRV.aif");
~bufArray[1] = Buffer.read(s, "/Users/colvin/Documents/SC3/MLoopPlayer/Audio/MLRVBass.aif");
~bufArray[2] = Buffer.read(s, "/Users/colvin/Documents/SC3/MLoopPlayer/Audio/MLRVPad.aif");
~bufArray[3] = Buffer.read(s, "/Users/colvin/Documents/SC3/MLoopPlayer/Audio/MLRVdrumghosts.aif");
)
( // sample player for Pmono
x = SynthDef(\MmLP, {|out = 0, bufnum, trig = 1, startPos = 0, rate = 1|
Out.ar(out,
PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum) * rate, trig, startPos, 1, 0)
)
}).add;
)
( //sample player for Ppoly
x = SynthDef(\MpLP, {|out = 0, bufnum, trig = 1, startPos = 0, gate = 1, fadeTime = 0.001|
OffsetOut.ar(out,
PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), trig, startPos, 0,)
* EnvGen.kr(Env.asr(fadeTime,1,fadeTime), gate, doneAction:2)
)
}).add;
)