-
Notifications
You must be signed in to change notification settings - Fork 1
/
rsh-improElectronics_midiSetup.scd
309 lines (247 loc) · 7.73 KB
/
rsh-improElectronics_midiSetup.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
// rsh-improElectronics
// This file assigns parameters to a Behringer X-Touch Mini MIDI-controller.
// If you are about to use another MIDI controller you'll have to change all MIDIdefs to the corresponding MIDI Note-Numbers and/or MIDI channels as well as the feedback-strings if desired.
// Expressions like "B-B-7" are named like this: First letter A or B indicating the MIDI Layer. Second one tells if top (T) or bottom (B) row. Last numbers tells you which column exactly.
// get ALL MIDI data for reassignment:
// MIDIFunc.trace(true);
// MIDIFunc.trace(false);
(
// X-Touch Mini
Tdef(\midiSetup, {
MIDIClient.init; // takes some time...
2.wait;
(
MIDIIn.connectAll;
~midiNoteSlots = Array.fill(127, { nil });
// FADER
// main volume (fader A)
(
MIDIdef.cc(\ccDef9, {
arg vel, key, channel, device;
~mainVol.set(vel.linlin(0.0, 127.0, 0.0, 1.0));
("current main volume: " ++~mainVol.getSynchronous).postln;
}, ccNum: 9, chan: 10);
);
// ENCODER
// panFreq (encoder A-1)
(
MIDIdef.cc(\ccDef1, {
arg vel, key, channel, device;
~panFreq.set(vel.linlin(0.0, 127.0, 0.1, 20.0));
("current panFreq: " ++~panFreq.getSynchronous).postln;
}, ccNum: 1, chan: 10);
);
// revVol (encoder A-2)
(
MIDIdef.cc(\ccDef2, {
arg vel, key, channel, device;
~revVol.set(vel.linlin(0.0, 127.0, 0.0, 1.0));
("current revVol: " ++~revVol.getSynchronous).postln;
}, ccNum: 2, chan: 10);
);
// delVol (encoder A-3)
(
MIDIdef.cc(\ccDef3, {
arg vel, key, channel, device;
~delVol.set(vel.linlin(0.0, 127.0, 0.0, 1.0));
("current delVol: " ++~delVol.getSynchronous).postln;
}, ccNum: 3, chan: 10);
);
// revModDepth (encoder A-4)
(
MIDIdef.cc(\ccDef4, {
arg vel, key, channel, device;
~revModDepth.set(vel.linlin(0.0, 127.0, 0.1, 1.0));
("current revModDepth: " ++~revModDepth.getSynchronous).postln;
}, ccNum: 4, chan: 10);
);
// revModFreq (encoder A-5)
(
MIDIdef.cc(\ccDef5, {
arg vel, key, channel, device;
~revModFreq.set(vel.linlin(0.0, 127.0, 1.0, 200.0));
("current revModFreq: " ++~revModFreq.getSynchronous).postln;
}, ccNum: 5, chan: 10);
);
// maxDelay (encoder A-6)
(
MIDIdef.cc(\ccDef6, {
arg vel, key, channel, device;
~maxDelay.set(vel.linlin(0.0, 127.0, 0.1, 3.0));
("current maxDelay: " ++~maxDelay.getSynchronous).postln;
}, ccNum: 6, chan: 10);
);
// PV_SpectralEnhance ratio (encoder A-7)
(
MIDIdef.cc(\ccDef7, {
arg vel, key, channel, device;
~ratioBus.set(vel.linlin(0.0, 127.0, 1.1, 4.0));
("current PV_SpectralEnhance ratio: " ++~ratioBus.getSynchronous).postln;
}, ccNum: 7, chan: 10);
);
// FluidAudioTransport interpolating ratio (encoder A-8)
(
MIDIdef.cc(\ccDef8, {
arg vel, key, channel, device;
~interpolBus.set(vel.linlin(0.0, 127.0, 0.0, 1.0));
("current interpolating ratio: " ++~interpolBus.getSynchronous).postln;
}, ccNum: 8, chan: 10);
);
// BUTTONS
// PV_BinScramble triggering (button A-T-1)
(
MIDIdef.noteOn(\onDef1, {
arg vel, key, channel, device;
~trigBus.set(1.rrand(127));
"new random bin order was triggered".postln;
}, noteNum: 8, chan: 10);
);
// source-target-resynthesis: recording (button A-B-1)
(
MIDIdef.noteOn(\onDef3, {
arg vel, key, channel, device;
~midiNoteSlots[key] = ~recording.();
("source-target-resynthesis: recording started for " ++~dur.() ++" seconds!").postln;
}, noteNum: 16, chan: 10);
);
(
MIDIdef.noteOff(\offDef3, {
arg vel, key, channel, device;
~midiNoteSlots[key].release;
}, noteNum: 16, chan: 10);
);
// source-target-resynthesis: Playback (button A-B-2)
(
MIDIdef.noteOn(\onDef4, {
arg vel, key, channel, device;
~midiNoteSlots[key] = ~recPlayBack.();
"source-target-resynthesis: Playback!".postln;
}, noteNum: 17, chan: 10);
);
(
MIDIdef.noteOff(\offDef4, {
arg vel, key, channel, device;
~midiNoteSlots[key].release;
}, noteNum: 17, chan: 10);
);
// source-target-resynthesis: Start resynthesis (button A-B-3)
(
MIDIdef.noteOn(\onDef5, {
arg vel, key, channel, device;
~midiNoteSlots[key] = ~resynthesis.();
"source-target-resynthesis: Resynthesis has started!".postln;
}, noteNum: 18, chan: 10);
);
(
MIDIdef.noteOff(\offDef5, {
arg vel, key, channel, device;
~midiNoteSlots[key].release;
}, noteNum: 18, chan: 10);
);
// source-target-resynthesis: Resynthesis Playback (button A-B-4)
(
MIDIdef.noteOn(\onDef6, {
arg vel, key, channel, device;
~midiNoteSlots[key] = ~resynthesisPlayback.();
"source-target-resynthesis: Resynthesis is played back!".postln;
}, noteNum: 19, chan: 10);
);
(
MIDIdef.noteOff(\offDef6, {
arg vel, key, channel, device;
~midiNoteSlots[key].release;
}, noteNum: 19, chan: 10);
);
// BUTTONS + ENCODER
// sample playback: Finnegans Sake (button B-T-1)
(
MIDIdef.noteOn(\onDef7, {
arg vel, key, channel, device;
~midiNoteSlots[key] = Synth(\samplePlayback, [\bufnum, ~finnegansSake, \bufDur, ~finnegansSake.duration, \volBus, ~volPlayback1]);
"sample playback: Finnegans Sake".postln;
}, noteNum: 32, chan: 10);
);
(
MIDIdef.noteOff(\offDef7, {
arg vel, key, channel, device;
~midiNoteSlots[key].release;
}, noteNum: 32, chan: 10);
);
// Finnegans Sake volume (encoder B-1)
(
MIDIdef.cc(\ccDef10, {
arg vel, key, channel, device;
~volPlayback1.set(vel.linlin(0.0, 127.0, 0.0, 1.0));
("current volume for Finnegans Sake: " ++~volPlayback1.getSynchronous).postln;
}, ccNum: 11, chan: 10);
);
// sample playback: Berge (button B-T-2)
(
MIDIdef.noteOn(\onDef8, {
arg vel, key, channel, device;
~midiNoteSlots[key] = Synth(\samplePlayback, [\bufnum, ~berge, \bufDur, ~berge.duration, \volBus, ~volPlayback2]);
"sample playback: Berge".postln;
}, noteNum: 33, chan: 10);
);
(
MIDIdef.noteOff(\offDef8, {
arg vel, key, channel, device;
~midiNoteSlots[key].release;
}, noteNum: 33, chan: 10);
);
// Berge volume (encoder B-2)
(
MIDIdef.cc(\ccDef11, {
arg vel, key, channel, device;
~volPlayback2.set(vel.linlin(0.0, 127.0, 0.0, 1.0));
("current volume for Berge: " ++~volPlayback2.getSynchronous).postln;
}, ccNum: 12, chan: 10);
);
// sample playback: Trumpet (button B-T-3)
(
MIDIdef.noteOn(\onDef9, {
arg vel, key, channel, device;
~midiNoteSlots[key] = Synth(\samplePlayback, [\bufnum, ~trumpet, \bufDur, ~trumpet.duration, \volBus, ~volPlayback3]);
"sample playback: Trumpet".postln;
}, noteNum: 34, chan: 10);
);
(
MIDIdef.noteOff(\offDef9, {
arg vel, key, channel, device;
~midiNoteSlots[key].release;
}, noteNum: 34, chan: 10);
);
// Trumpet volume (encoder B-3)
(
MIDIdef.cc(\ccDef12, {
arg vel, key, channel, device;
~volPlayback3.set(vel.linlin(0.0, 127.0, 0.0, 1.0));
("current volume for Trumpet: " ++~volPlayback3.getSynchronous).postln;
}, ccNum: 13, chan: 10);
);
// sample playback: Signature (button B-T-4)
(
MIDIdef.noteOn(\onDef10, {
arg vel, key, channel, device;
~midiNoteSlots[key] = Synth(\samplePlayback, [\bufnum, ~signature, \bufDur, ~signature.duration, \volBus, ~volPlayback4]);
"sample playback: Signature".postln;
}, noteNum: 35, chan: 10);
);
(
MIDIdef.noteOff(\offDef10, {
arg vel, key, channel, device;
~midiNoteSlots[key].release;
}, noteNum: 35, chan: 10);
);
// Signature volume (encoder B-4)
(
MIDIdef.cc(\ccDef13, {
arg vel, key, channel, device;
~volPlayback4.set(vel.linlin(0.0, 127.0, 0.0, 1.0));
("current volume for Signature: " ++~volPlayback4.getSynchronous).postln;
}, ccNum: 14, chan: 10);
);
);
"MIDI Setup is ready!".postln;
}).play;
)