-
Notifications
You must be signed in to change notification settings - Fork 8
/
KEYBOARD.pd
407 lines (407 loc) · 11 KB
/
KEYBOARD.pd
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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
#N canvas 78 23 1202 755 10;
#X text 407 356 create keyboard;
#X obj 38 18 inlet;
#X obj 38 152 max 0;
#X obj 38 131 min 6;
#X obj 38 181 * 10;
#X obj 413 145 \$1;
#X obj 413 168 t b f;
#X obj 930 302 list store obj_\$0;
#X obj 413 13 loadbang;
#X floatatom 497 164 5 0 0 0 - - -;
#X text 697 375 send msg to LP_GUI only once \; when LP_GUI asks for
\;;
#X msg 413 196 1;
#X text 209 511 MSG TO LP_GUI \; \; list where first element is the
object name \; followed by a list of pairs of integers \; where 1st
is "elem_id" (pad/button) and \; 2nd is the color \;;
#X msg 38 352 11 41 12 38 13 38 14 38 15 38 16 38 17 38 18 41 22 38
23 38 25 38 26 38 27 38;
#X obj 38 537 list prepend obj_\$0;
#N canvas 363 175 882 534 OFFSET 0;
#X obj 37 37 inlet;
#X msg 37 136 11 41 12 38 13 38 14 38 15 38 16 38 17 38 18 41 22 38
23 38 25 38 26 38 27 38;
#X obj 37 280 unpack;
#X obj 37 301 +;
#X obj 37 322 pack;
#X obj 86 241 list store;
#X obj 37 239 t b l;
#X obj 37 218 list split 2;
#X obj 37 453 outlet;
#X text 118 36 apply offset to only even elements of the list (ie elem
0 \, 2 \, 4 \, etc.);
#X obj 37 343 list prepend;
#X obj 37 425 list store;
#X obj 37 88 t b f b b;
#X obj 37 177 t l l;
#X obj 232 221 list length;
#X obj 199 398 sel -1;
#X obj 37 364 t b l l;
#X obj 199 302 f 0;
#X obj 199 323 t f f;
#X obj 249 323 + 1;
#X obj 232 276 - 1;
#X msg 199 266 0;
#X obj 232 248 div 2;
#N canvas 0 23 460 300 CHANGE_BG_COLOR 0;
#X obj 40 53 min 127;
#X obj 40 76 max 0;
#X obj 40 28 r \$0_color_bg;
#X msg 40 149 11 \$1 12 \$1 13 \$1 14 \$1 15 \$1 16 \$1 17 \$1 18 \$1
22 \$1 23 \$1 25 \$1 26 \$1 27 \$1;
#X obj 40 261 outlet;
#X obj 40 185 list prepend set;
#X obj 40 223 list trim;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 2 0 0 0;
#X connect 3 0 5 0;
#X connect 5 0 6 0;
#X connect 6 0 4 0;
#X restore 317 63 pd CHANGE_BG_COLOR;
#X obj 344 455 outlet;
#X text 332 484 after changing color \; allow LP_GUI to query \;;
#X obj 317 85 t b b a;
#X obj 37 62 f;
#X obj 504 25 loadbang;
#X msg 504 66 set 11 41 12 38 13 38 14 38 15 38 16 38 17 38 18 41 22
38 23 38 25 38 26 38 27 38;
#X text 762 46 default colors;
#X connect 0 0 27 0;
#X connect 1 0 13 0;
#X connect 2 0 3 0;
#X connect 2 1 4 1;
#X connect 3 0 4 0;
#X connect 4 0 10 0;
#X connect 5 0 7 0;
#X connect 6 0 5 0;
#X connect 6 1 2 0;
#X connect 7 0 6 0;
#X connect 7 1 5 1;
#X connect 10 0 16 0;
#X connect 11 0 8 0;
#X connect 12 0 1 0;
#X connect 12 1 3 1;
#X connect 12 2 10 1;
#X connect 12 3 21 0;
#X connect 13 0 7 0;
#X connect 13 1 14 0;
#X connect 14 0 22 0;
#X connect 15 0 11 0;
#X connect 16 0 17 0;
#X connect 16 1 11 1;
#X connect 16 2 10 1;
#X connect 17 0 18 0;
#X connect 18 0 15 0;
#X connect 18 1 19 0;
#X connect 19 0 17 1;
#X connect 20 0 15 1;
#X connect 21 0 17 1;
#X connect 22 0 20 0;
#X connect 23 0 26 0;
#X connect 26 0 24 0;
#X connect 26 1 27 0;
#X connect 26 2 1 0;
#X connect 27 0 12 0;
#X connect 28 0 29 0;
#X connect 29 0 1 0;
#X restore 38 202 pd OFFSET;
#X obj 38 223 list prepend set;
#X obj 38 244 list trim;
#X obj 687 550 r \$0_id;
#X obj 687 571 outlet;
#X obj 744 571 outlet;
#X floatatom 457 164 5 0 0 0 - - -;
#X obj 457 143 \$2;
#X obj 457 184 s \$0_transpose;
#X msg 162 415 36 38 40 41 43 45 47 48 37 39 42 44 46;
#X obj 38 384 t l l b;
#X text 206 433 map 'elem_id' from LP_GUI \; to chromatic keyboard
starting \; from C1 (MIDI 36) \;;
#X text 916 346 send 'obj_unique_id' to LP_GUI \;;
#X obj 718 186 print -n;
#N canvas 268 186 781 482 PROCESSING 0;
#X obj 53 93 r to_obj_\$0;
#X obj 53 204 unpack 0 0 0;
#X text 104 155 elem_id \, color \, status \;;
#X obj 122 253 sel 0;
#X obj 53 336 pack;
#X text 93 335 elem_id \, color \;;
#X obj 93 253 f;
#X obj 87 224 swap;
#X text 180 287 on_color \;;
#X msg 149 288 120;
#X obj 53 154 t l l;
#X obj 303 204 unpack 0 0 0;
#X obj 303 286 moses;
#X obj 330 307 tabread \$0_OUTPUT;
#X obj 303 265 text search \$0_BUFFER;
#X obj 330 378 s \$0_id;
#N canvas 217 218 903 533 INTERNAL_BUFFER 0;
#X obj 116 49 inlet;
#X obj 116 140 list split 2;
#X obj 180 179 list;
#X obj 116 180 t b l b;
#X obj 135 230 unpack;
#X text 49 226 only elem_id \; skip color \;;
#X text 42 138 keep list \; order \;;
#X obj 293 73 text define \$0_BUFFER;
#X msg 293 49 clear;
#X msg 196 292 1e+09;
#X obj 135 321 text insert \$0_BUFFER;
#X obj 168 255 b;
#X msg 339 49 click;
#X obj 432 72 array define \$0_OUTPUT;
#X obj 408 149 list length;
#X msg 447 259 const 0;
#X obj 447 284 s \$0_OUTPUT;
#X msg 427 235 resize \$1;
#X msg 579 216 arrayviewlistnew;
#X msg 579 239 arrayviewclose;
#X obj 408 191 t b f b;
#X obj 408 364 array set \$0_OUTPUT;
#X text 574 194 check array content \;;
#X obj 186 49 inlet;
#X obj 116 79 t l b;
#X obj 186 70 t l l;
#X connect 0 0 24 0;
#X connect 1 0 3 0;
#X connect 1 1 2 1;
#X connect 2 0 1 0;
#X connect 3 0 2 0;
#X connect 3 1 4 0;
#X connect 4 0 10 0;
#X connect 4 1 11 0;
#X connect 8 0 7 0;
#X connect 9 0 10 1;
#X connect 11 0 9 0;
#X connect 12 0 7 0;
#X connect 14 0 20 0;
#X connect 15 0 16 0;
#X connect 17 0 16 0;
#X connect 18 0 16 0;
#X connect 19 0 16 0;
#X connect 20 1 17 0;
#X connect 20 2 15 0;
#X connect 23 0 25 0;
#X connect 24 0 1 0;
#X connect 24 1 8 0;
#X connect 25 0 21 0;
#X connect 25 1 14 0;
#X restore 474 158 pd INTERNAL_BUFFER;
#X obj 474 114 inlet;
#X obj 330 338 +;
#X text 470 272 keyboard transpose \;;
#X obj 470 289 r \$0_transpose;
#X floatatom 470 310 5 0 0 0 - - -;
#X text 38 12 when live interaction happens (press pad/button on actual
HW) \, LP_GUI send 'elem_id' \, 'color' and 'status' to the right object
\, that then can reply ('elem_id' and 'color') to trigger visual feedback
on the device (ie light up a pad) \;;
#X obj 579 114 inlet;
#X text 437 89 list of elem_ids;
#X text 567 89 list of values to map to elem_ids;
#X text 52 402 to LP hardware \;;
#X text 339 403 object outlets \;;
#X floatatom 191 225 5 0 0 0 - - -;
#X obj 380 378 s \$0_velocity;
#X obj 53 375 s \$3_MIDI_to_LP_GUI;
#X obj 470 378 s \$0_p_touch;
#X obj 53 122 route list velocity polytouch;
#X obj 280 90 r \$0_color_fg;
#X msg 280 161 set \$1;
#X obj 280 115 min 127;
#X obj 280 138 max 0;
#X obj 454 16 loadbang;
#X msg 454 37 120;
#X connect 0 0 32 0;
#X connect 1 0 4 0;
#X connect 1 1 7 0;
#X connect 1 2 7 1;
#X connect 3 0 6 0;
#X connect 3 1 9 0;
#X connect 4 0 30 0;
#X connect 6 0 4 1;
#X connect 7 0 3 0;
#X connect 7 1 6 1;
#X connect 9 0 4 1;
#X connect 10 0 1 0;
#X connect 10 1 11 0;
#X connect 11 0 14 0;
#X connect 12 1 13 0;
#X connect 13 0 18 0;
#X connect 14 0 12 0;
#X connect 17 0 16 0;
#X connect 18 0 15 0;
#X connect 20 0 21 0;
#X connect 21 0 18 1;
#X connect 23 0 16 1;
#X connect 28 0 29 0;
#X connect 32 0 10 0;
#X connect 32 1 28 0;
#X connect 32 2 31 0;
#X connect 33 0 35 0;
#X connect 34 0 9 0;
#X connect 35 0 36 0;
#X connect 36 0 34 0;
#X connect 37 0 38 0;
#X connect 38 0 35 0;
#X restore 57 449 pd PROCESSING;
#X obj 744 550 r \$0_velocity;
#X obj 206 76 s \$0_print_args;
#X obj 718 17 r \$0_print_args;
#N canvas 0 23 338 255 OCTAVE 0;
#X obj 96 27 inlet;
#X obj 96 59 max 0;
#X obj 96 141 * 12;
#X obj 96 110 - 3;
#X obj 96 182 outlet;
#X obj 96 80 min 10;
#X connect 0 0 1 0;
#X connect 1 0 5 0;
#X connect 2 0 4 0;
#X connect 3 0 2 0;
#X connect 5 0 3 0;
#X restore 150 98 pd OCTAVE;
#X floatatom 150 77 5 0 0 0 - - -;
#X obj 834 571 outlet;
#X obj 537 143 \$0;
#X floatatom 537 164 5 0 0 0 - - -;
#X obj 497 143 \$3;
#X obj 413 104 t b b b b;
#X obj 930 194 r \$3_heartbeat;
#X obj 930 323 s \$3_heartbeat_reply;
#X obj 618 272 r \$3_from_LP_GUI;
#X obj 38 574 s \$3_to_LP_GUI;
#X obj 929 571 outlet;
#X obj 929 550 r \$0_p_touch;
#X text 743 593 velocity;
#X text 683 593 pitch;
#X text 829 593 aftertouch;
#X text 925 593 polytouch;
#X obj 618 310 spigot;
#X obj 618 401 t b b;
#X obj 618 336 f 0;
#X obj 618 357 t f f;
#X obj 618 378 sel 1;
#X obj 658 357 + 1;
#X obj 728 77 r \$0_print_outlets;
#X obj 256 97 s \$0_print_outlets;
#X msg 728 101 KEYBOARD OUTLETS \, 1: pitch \, 2: velocity \, 3: aftertouch
\, 4: polytouch \;;
#X msg 718 41 KEYBOARD ARGS \, 1: keyboard row (0 index) \, 2: keyboard
transpose (+-semitones from note 36) \, 3: LP_GUI_id \;;
#X obj 834 550 r _aftertouch;
#X obj 354 62 s \$0_print_methods;
#X obj 749 137 r \$0_print_methods;
#X obj 1003 403 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 1042 512 s \$0_print_args;
#X obj 1003 463 s \$0_print_outlets;
#X obj 1022 486 s \$0_print_methods;
#X obj 1003 428 t b b b;
#X obj 38 40 route bang transpose octave print_args print_outlets print_methods
color_bg color_fg, f 85;
#X obj 502 69 s \$0_color_bg;
#X obj 512 89 s \$0_color_fg;
#X obj 930 273 spigot 1;
#X msg 618 426 0;
#X obj 618 447 t f f;
#X obj 111 201 s \$0_change_color_bg;
#X obj 750 226 r \$0_change_color_bg;
#X obj 930 223 t b b;
#X msg 930 244 1;
#X obj 750 247 t b b;
#X msg 777 269 0;
#X msg 750 269 1;
#X msg 749 159 KEYBOARD METHODS \, transpose \, octave \, color_bg
\, color_fg \;;
#X text 684 647 Copyright 2019-2020 Focusrite Audio Engineering Limited.
;
#X text 715 769 http://www.apache.org/licenses/LICENSE-2.0;
#X text 685 677 Licensed under the Apache License \, Version 2 (the
"License") \; you may not use this file except in compliance with the
License.;
#X text 685 734 You may obtain a copy of the License at;
#X text 685 799 Unless required by applicable law or agreed to in writing
\, software distributed under the License is distributed on an "AS
IS" BASIS \, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND \, either
express or implied.;
#X text 685 855 See the License for the specific language governing
permissions and limitations under the License.;
#X connect 1 0 68 0;
#X connect 2 0 4 0;
#X connect 3 0 2 0;
#X connect 4 0 15 0;
#X connect 5 0 6 0;
#X connect 6 0 11 0;
#X connect 6 1 3 0;
#X connect 7 0 41 0;
#X connect 8 0 39 0;
#X connect 11 0 50 1;
#X connect 13 0 25 0;
#X connect 14 0 43 0;
#X connect 15 0 16 0;
#X connect 15 1 74 0;
#X connect 16 0 17 0;
#X connect 17 0 13 0;
#X connect 18 0 19 0;
#X connect 21 0 23 0;
#X connect 22 0 21 0;
#X connect 24 0 29 1;
#X connect 25 0 14 0;
#X connect 25 1 29 0;
#X connect 25 2 24 0;
#X connect 30 0 20 0;
#X connect 32 0 59 0;
#X connect 33 0 21 0;
#X connect 34 0 33 0;
#X connect 36 0 37 0;
#X connect 38 0 9 0;
#X connect 39 0 5 0;
#X connect 39 1 22 0;
#X connect 39 2 38 0;
#X connect 39 3 36 0;
#X connect 40 0 76 0;
#X connect 42 0 50 0;
#X connect 45 0 44 0;
#X connect 50 0 52 0;
#X connect 51 0 72 0;
#X connect 51 1 13 0;
#X connect 52 0 53 0;
#X connect 53 0 54 0;
#X connect 53 1 55 0;
#X connect 54 0 51 0;
#X connect 55 0 52 1;
#X connect 56 0 58 0;
#X connect 58 0 28 0;
#X connect 59 0 28 0;
#X connect 60 0 35 0;
#X connect 62 0 81 0;
#X connect 63 0 67 0;
#X connect 67 0 65 0;
#X connect 67 1 66 0;
#X connect 67 2 64 0;
#X connect 68 0 3 0;
#X connect 68 1 21 0;
#X connect 68 2 34 0;
#X connect 68 3 31 0;
#X connect 68 4 57 0;
#X connect 68 5 61 0;
#X connect 68 6 69 0;
#X connect 68 7 70 0;
#X connect 71 0 7 0;
#X connect 72 0 73 0;
#X connect 73 0 52 1;
#X connect 73 1 50 1;
#X connect 75 0 78 0;
#X connect 76 0 77 0;
#X connect 76 1 71 0;
#X connect 77 0 71 1;
#X connect 78 0 80 0;
#X connect 78 1 79 0;
#X connect 79 0 71 1;
#X connect 80 0 50 1;
#X connect 81 0 28 0;
#X coords 0 -1 1 1 120 21 1 900 400;