-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathedrumulus.ino
556 lines (508 loc) · 22.2 KB
/
edrumulus.ino
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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
/******************************************************************************\
* Copyright (c) 2020-2024
* Author(s): Volker Fischer
******************************************************************************
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\******************************************************************************/
#define USE_MIDI
// ESP32 default pin definition ("-1" means that this channel is unused):
// For older prototypes or custom implementations, simply change the GPIO numbers in the table below
// to match your hardware (note that the GPIO assignment of Prototype 2 is the same as Prototype 4).
// clang-format off
// analog pins setup: snare | kick | hi-hat | hi-hat-ctrl | crash | tom1 | ride | tom2 | tom3
static int analog_pins4[] = { 36, 33, 32, 25, 34, 39, 27, 12, 15 };
static int analog_pins_rimshot4[] = { 35, -1, 26, -1, 14, -1, 13, -1, -1 };
// clang-format on
// if you want to use less number of pads, simply adjust number_pads4 value
// const int number_pads4 = sizeof ( analog_pins4 ) / sizeof ( int ); // example: use all inputs defined in analog_pins4
const int number_pads4 = 8; // example: do not use tom3 and shrink number of pads from 9 to 8
// const int number_pads4 = 1; // example: just one single pad
#include "edrumulus.h"
#ifdef USE_MIDI
# ifdef ESP_PLATFORM
# include <MIDI.h>
# ifdef USE_TINYUSB
# include <Adafruit_TinyUSB.h>
Adafruit_USBD_MIDI usb_midi;
MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI);
# else
MIDI_CREATE_DEFAULT_INSTANCE();
# endif
# define MYMIDI MIDI
# define MIDI_CONTROL_CHANGE_TYPE midi::ControlChange
# define MIDI_SEND_AFTER_TOUCH sendAfterTouch
# define MIDI_SERIAL 38400
# endif
# ifdef TEENSYDUINO
# define MYMIDI usbMIDI
# define MIDI_CONTROL_CHANGE_TYPE usbMIDI.ControlChange
# define MIDI_SEND_AFTER_TOUCH sendAfterTouchPoly
# endif
#endif
// local variables and defines
Edrumulus edrumulus;
const int midi_channel = 10; // default for edrums is 10
const int hihat_pad_idx = 2; // this definition should not be changed
const int hihatctrl_pad_idx = 3; // this definition should not be changed
int number_pads = number_pads4; // initialization value, may be overwritten by get_prototype_pins()
int status_LED_pin = 0; // initialization value, will be set in get_prototype_pins()
bool is_status_LED_on = false; // initialization value
int selected_pad = 0; // initialization value
void setup()
{
// get the pin-to-pad assignments
int* analog_pins = analog_pins4; // initialize with the default setup
int* analog_pins_rimshot = analog_pins_rimshot4; // initialize with the default setup
const int prototype = Edrumulus_hardware::get_prototype_pins(&analog_pins,
&analog_pins_rimshot,
&number_pads,
&status_LED_pin);
// initialize GPIO port for status LED and set it to on during setup
pinMode(status_LED_pin, OUTPUT);
digitalWrite(status_LED_pin, HIGH);
#if defined(USE_SERIAL_DEBUG_PLOTTING) && defined(ESP_PLATFORM)
number_pads = min(number_pads, 7); // only max. 7 pads are supported for ESP32 serial debug plotting
#endif
#ifdef USE_MIDI
# ifdef USE_TINYUSB
TinyUSBDevice.setProductDescriptor("Edrumulus");
# endif
MYMIDI.begin();
#endif
#ifdef MIDI_SERIAL
if (prototype == 5)
{
Serial.begin(115200); // faster communication on prototype 5
}
else
{
Serial.begin(MIDI_SERIAL);
}
#else
Serial.begin(115200);
#endif
edrumulus.setup(number_pads, analog_pins, analog_pins_rimshot);
digitalWrite(status_LED_pin, LOW); // set board LED to low right after setup is done
#ifdef ESP_PLATFORM
preset_settings(); // for ESP32, the load/save of settings is not supported, preset instead
#else
read_settings();
#endif
}
void preset_settings()
{
// default MIDI note assignments
edrumulus.set_midi_notes(0, 38, 40); // snare
edrumulus.set_midi_notes(1, 36, 36); // kick
edrumulus.set_midi_notes(hihat_pad_idx, 22 /*42*/, 22);
edrumulus.set_midi_notes_open(hihat_pad_idx, 26 /*46*/, 26);
edrumulus.set_midi_notes(hihatctrl_pad_idx, 44, 44); // Hi-Hat pedal hit
edrumulus.set_midi_notes(4, 49, 55); // crash
edrumulus.set_midi_notes(5, 48, 50); // tom 1
edrumulus.set_midi_notes(6, 51, 53 /*59*/); // ride (edge: 59, bell: 53)
edrumulus.set_midi_notes(7, 45, 47); // tom 2
edrumulus.set_midi_notes(8, 43, 58); // tom 3
// default drum kit setup
edrumulus.set_pad_type(0, Pad::PD8); // snare
edrumulus.set_pad_type(1, Pad::KD7); // kick
edrumulus.set_pad_type(2, Pad::PD6); // Hi-Hat
edrumulus.set_pad_type(3, Pad::FD8); // Hi-Hat-ctrl
edrumulus.set_pad_type(4, Pad::CY6); // crash
edrumulus.set_pad_type(5, Pad::TP80); // tom 1
edrumulus.set_pad_type(6, Pad::CY8); // ride
edrumulus.set_pad_type(7, Pad::TP80); // tom 2
edrumulus.set_pad_type(8, Pad::TP80); // tom 3
}
void loop()
{
// this function is blocking at the system sampling rate
edrumulus.process();
// status LED handling
if (edrumulus.get_status_is_overload() || edrumulus.get_status_is_error())
{
if (!is_status_LED_on)
{
digitalWrite(status_LED_pin, HIGH);
is_status_LED_on = true;
#ifdef USE_MIDI
if (edrumulus.get_status_is_error())
{
const int dc_offset_error_channel = edrumulus.get_status_dc_offset_error_channel();
if (dc_offset_error_channel >= 0)
{
// > 63 means DC offset error and pad/input index is coded in one value
MYMIDI.sendNoteOff(125, 64 + dc_offset_error_channel, 1);
}
else
{
// 1 means to set error state
MYMIDI.sendNoteOff(125, 1, 1);
}
}
#endif
}
}
else
{
if (is_status_LED_on)
{
digitalWrite(status_LED_pin, LOW);
is_status_LED_on = false;
#ifdef USE_MIDI
MYMIDI.sendNoteOff(125, 0, 1); // 0 means that all errors are cleared
#endif
}
}
#ifdef USE_MIDI
// send MIDI note to drum synthesizer
for (int pad_idx = 0; pad_idx < number_pads; pad_idx++)
{
if (edrumulus.get_peak_found(pad_idx))
{
// get current MIDI note and velocity (maybe note will be overwritten later on)
const int midi_velocity = edrumulus.get_midi_velocity(pad_idx);
int midi_note = edrumulus.get_midi_note(pad_idx);
// send midi positional control message if positional sensing is enabled for the current pad
if (edrumulus.get_pos_sense_is_used(pad_idx))
{
const int midi_pos = edrumulus.get_midi_pos(pad_idx);
MYMIDI.sendControlChange(16, midi_pos, midi_channel); // positional sensing
}
// send Hi-Hat control message right before each Hi-Hat pad hit
if (pad_idx == hihat_pad_idx)
{
const int midi_ctrl_ch = edrumulus.get_midi_ctrl_ch(hihatctrl_pad_idx);
const int midi_ctrl_value = edrumulus.get_midi_ctrl_value(hihatctrl_pad_idx);
const bool hi_hat_is_open = edrumulus.get_midi_ctrl_is_open(hihatctrl_pad_idx);
MYMIDI.sendControlChange(midi_ctrl_ch, midi_ctrl_value, midi_channel);
// if Hi-Hat is open, overwrite MIDI note
if (hi_hat_is_open)
{
midi_note = edrumulus.get_midi_note_open(pad_idx);
}
}
MYMIDI.sendNoteOn(midi_note, midi_velocity, midi_channel); // (note, velocity, channel)
MYMIDI.sendNoteOff(midi_note, 0, midi_channel); // we need a note off
}
if (edrumulus.get_control_found(pad_idx))
{
const int midi_ctrl_ch = edrumulus.get_midi_ctrl_ch(pad_idx);
const int midi_ctrl_value = edrumulus.get_midi_ctrl_value(pad_idx);
MYMIDI.sendControlChange(midi_ctrl_ch, midi_ctrl_value, midi_channel);
}
if (edrumulus.get_choke_on_found(pad_idx))
{
// special case: if MIDI note open rim is set to zero, we use NoteOn instead of aftertouch
// for cymbal choke (#85), where the MIDI note for NoteOn is defined by MIDI note open norm
if (edrumulus.get_midi_note_open_rim(pad_idx) == 0)
{
// special case: if grabbed edge found, we send a MIDI NoteOn
const int midi_choke_noteon = edrumulus.get_midi_note_open_norm(pad_idx);
MYMIDI.sendNoteOn(midi_choke_noteon, 127, midi_channel);
MYMIDI.sendNoteOff(midi_choke_noteon, 0, midi_channel); // we need a note off
}
else
{
// if grabbed edge found, polyphonic aftertouch at 127 is transmitted for all notes of the pad
MYMIDI.MIDI_SEND_AFTER_TOUCH(edrumulus.get_midi_note_norm(pad_idx), 127, midi_channel);
MYMIDI.MIDI_SEND_AFTER_TOUCH(edrumulus.get_midi_note_rim(pad_idx), 127, midi_channel);
MYMIDI.MIDI_SEND_AFTER_TOUCH(edrumulus.get_midi_note_open_norm(pad_idx), 127, midi_channel);
MYMIDI.MIDI_SEND_AFTER_TOUCH(edrumulus.get_midi_note_open_rim(pad_idx), 127, midi_channel);
}
}
else if (edrumulus.get_choke_off_found(pad_idx))
{
// if released edge found, polyphonic aftertouch at 0 is transmitted for all notes of the pad
MYMIDI.MIDI_SEND_AFTER_TOUCH(edrumulus.get_midi_note_norm(pad_idx), 0, midi_channel);
MYMIDI.MIDI_SEND_AFTER_TOUCH(edrumulus.get_midi_note_rim(pad_idx), 0, midi_channel);
MYMIDI.MIDI_SEND_AFTER_TOUCH(edrumulus.get_midi_note_open_norm(pad_idx), 0, midi_channel);
MYMIDI.MIDI_SEND_AFTER_TOUCH(edrumulus.get_midi_note_open_rim(pad_idx), 0, midi_channel);
}
}
// receiving MIDI messages to change the pad settings: edrumuluscontrol.m -> loopMIDI -> Hairless MIDI
if (MYMIDI.read(midi_channel))
{
if (MYMIDI.getType() == MIDI_CONTROL_CHANGE_TYPE)
{
const int controller = MYMIDI.getData1();
const int value = MYMIDI.getData2();
// controller 102: pad type
if (controller == 102)
{
edrumulus.set_pad_type(selected_pad, static_cast<Pad::Epadtype>(value));
edrumulus.write_setting(selected_pad, 0, value);
// on a pad type change, return all parameters of the selected pad
confirm_setting(controller, value, true);
}
// controller 103: threshold
if (controller == 103)
{
edrumulus.set_velocity_threshold(selected_pad, value);
edrumulus.write_setting(selected_pad, 1, value);
confirm_setting(controller, value, false);
}
// controller 104: sensitivity
if (controller == 104)
{
edrumulus.set_velocity_sensitivity(selected_pad, value);
edrumulus.write_setting(selected_pad, 2, value);
confirm_setting(controller, value, false);
}
// controller 105: positional sensing threshold
if (controller == 105)
{
edrumulus.set_pos_threshold(selected_pad, value);
edrumulus.write_setting(selected_pad, 3, value);
confirm_setting(controller, value, false);
}
// controller 106: positional sensing sensitivity
if (controller == 106)
{
edrumulus.set_pos_sensitivity(selected_pad, value);
edrumulus.write_setting(selected_pad, 4, value);
confirm_setting(controller, value, false);
}
// controller 107: rim shot threshold
if (controller == 107)
{
edrumulus.set_rim_shot_threshold(selected_pad, value);
edrumulus.write_setting(selected_pad, 5, value);
confirm_setting(controller, value, false);
}
// controller 108: select pad
if ((controller == 108) && (value < MAX_NUM_PADS))
{
selected_pad = value;
// on a pad selection, return all parameters of the selected pad
confirm_setting(controller, value, true);
}
// controller 109: MIDI curve type
if (controller == 109)
{
edrumulus.set_curve(selected_pad, static_cast<Pad::Ecurvetype>(value));
edrumulus.write_setting(selected_pad, 6, value);
confirm_setting(controller, value, false);
}
// controller 110: spike cancellation level
if (controller == 110)
{
edrumulus.set_spike_cancel_level(value);
edrumulus.write_setting(number_pads, 0, value);
confirm_setting(controller, value, false);
}
// controller 111: enable/disable rim shot and positional sensing support
if (controller == 111)
{
switch (value)
{
case 0:
edrumulus.set_rim_shot_is_used(selected_pad, false);
edrumulus.write_setting(selected_pad, 7, false);
edrumulus.set_pos_sense_is_used(selected_pad, false);
edrumulus.write_setting(selected_pad, 8, false);
break;
case 1:
edrumulus.set_rim_shot_is_used(selected_pad, true);
edrumulus.write_setting(selected_pad, 7, true);
edrumulus.set_pos_sense_is_used(selected_pad, false);
edrumulus.write_setting(selected_pad, 8, false);
break;
case 2:
edrumulus.set_rim_shot_is_used(selected_pad, false);
edrumulus.write_setting(selected_pad, 7, false);
edrumulus.set_pos_sense_is_used(selected_pad, true);
edrumulus.write_setting(selected_pad, 8, true);
break;
case 3:
edrumulus.set_rim_shot_is_used(selected_pad, true);
edrumulus.write_setting(selected_pad, 7, true);
edrumulus.set_pos_sense_is_used(selected_pad, true);
edrumulus.write_setting(selected_pad, 8, true);
break;
}
confirm_setting(controller, value, false);
}
// controller 112: normal MIDI note
if (controller == 112)
{
edrumulus.set_midi_note_norm(selected_pad, value);
edrumulus.write_setting(selected_pad, 9, value);
confirm_setting(controller, value, false);
}
// controller 113: MIDI note for rim
if (controller == 113)
{
edrumulus.set_midi_note_rim(selected_pad, value);
edrumulus.write_setting(selected_pad, 10, value);
confirm_setting(controller, value, false);
}
// controller 114: cross talk cancellation
if (controller == 114)
{
edrumulus.set_cancellation(selected_pad, value);
edrumulus.write_setting(selected_pad, 11, value);
confirm_setting(controller, value, false);
}
// controller 115: apply preset settings and store these to the EEPROM
if (controller == 115)
{
preset_settings();
write_all_settings();
confirm_setting(controller, value, false);
}
// controller 116: normal MIDI note open (Hi-Hat)
if (controller == 116)
{
edrumulus.set_midi_note_open_norm(selected_pad, value);
edrumulus.write_setting(selected_pad, 12, value);
confirm_setting(controller, value, false);
}
// controller 117: MIDI note open (Hi-Hat) for rim
if (controller == 117)
{
edrumulus.set_midi_note_open_rim(selected_pad, value);
edrumulus.write_setting(selected_pad, 13, value);
confirm_setting(controller, value, false);
}
// controller 118: mask time
if (controller == 118)
{
edrumulus.set_mask_time(selected_pad, value);
edrumulus.write_setting(selected_pad, 14, value);
confirm_setting(controller, value, false);
}
// controller 119: rim shot boost
if (controller == 119)
{
edrumulus.set_rim_shot_boost(selected_pad, value);
edrumulus.write_setting(selected_pad, 15, value);
confirm_setting(controller, value, false);
}
// controller 120: pad coupling
if (controller == 120)
{
edrumulus.set_coupled_pad_idx(selected_pad, value);
edrumulus.write_setting(selected_pad, 16, value);
confirm_setting(controller, value, false);
}
// controller 121: rim positional sensing threshold
if (controller == 121)
{
edrumulus.set_rim_pos_threshold(selected_pad, value);
edrumulus.write_setting(selected_pad, 17, value);
confirm_setting(controller, value, false);
}
// controller 122: rim positional sensing sensitivity
if (controller == 122)
{
edrumulus.set_rim_pos_sensitivity(selected_pad, value);
edrumulus.write_setting(selected_pad, 18, value);
confirm_setting(controller, value, false);
}
}
}
#endif
}
#ifdef USE_MIDI
// give feedback to the controller GUI via MIDI Note Off
void confirm_setting(const int controller,
const int value,
const bool send_all)
{
if (send_all)
{
// return all parameters of the selected pad
MYMIDI.sendNoteOff(102, static_cast<int>(edrumulus.get_pad_type(selected_pad)), 1);
MYMIDI.sendNoteOff(103, edrumulus.get_velocity_threshold(selected_pad), 1);
MYMIDI.sendNoteOff(104, edrumulus.get_velocity_sensitivity(selected_pad), 1);
MYMIDI.sendNoteOff(105, edrumulus.get_pos_threshold(selected_pad), 1);
MYMIDI.sendNoteOff(106, edrumulus.get_pos_sensitivity(selected_pad), 1);
MYMIDI.sendNoteOff(107, edrumulus.get_rim_shot_threshold(selected_pad), 1);
MYMIDI.sendNoteOff(108, selected_pad, 1);
MYMIDI.sendNoteOff(109, static_cast<int>(edrumulus.get_curve(selected_pad)), 1);
MYMIDI.sendNoteOff(110, edrumulus.get_spike_cancel_level(), 1);
MYMIDI.sendNoteOff(111, edrumulus.get_rim_shot_is_used(selected_pad) + 2 * edrumulus.get_pos_sense_is_used(selected_pad), 1);
MYMIDI.sendNoteOff(112, edrumulus.get_midi_note_norm(selected_pad), 1);
MYMIDI.sendNoteOff(113, edrumulus.get_midi_note_rim(selected_pad), 1);
MYMIDI.sendNoteOff(114, edrumulus.get_cancellation(selected_pad), 1);
MYMIDI.sendNoteOff(116, edrumulus.get_midi_note_open_norm(selected_pad), 1);
MYMIDI.sendNoteOff(117, edrumulus.get_midi_note_open_rim(selected_pad), 1);
MYMIDI.sendNoteOff(118, edrumulus.get_mask_time(selected_pad), 1);
MYMIDI.sendNoteOff(119, edrumulus.get_rim_shot_boost(selected_pad), 1);
MYMIDI.sendNoteOff(120, edrumulus.get_coupled_pad_idx(selected_pad), 1);
MYMIDI.sendNoteOff(121, edrumulus.get_rim_pos_threshold(selected_pad), 1);
MYMIDI.sendNoteOff(122, edrumulus.get_rim_pos_sensitivity(selected_pad), 1);
// NOTE: 125 reserved for error message
MYMIDI.sendNoteOff(126, VERSION_MINOR, 1);
MYMIDI.sendNoteOff(127, VERSION_MAJOR, 1);
}
else
{
// return only the given parameter
MYMIDI.sendNoteOff(controller, value, 1); // can be checked, e.g., in the log file
}
}
#endif
void read_settings()
{
for (int i = 0; i < number_pads; i++)
{
// NOTE that it is important that set_pad_type() is called first because it resets all other parameters
edrumulus.set_pad_type(i, static_cast<Pad::Epadtype>(edrumulus.read_setting(i, 0)));
edrumulus.set_velocity_threshold(i, edrumulus.read_setting(i, 1));
edrumulus.set_velocity_sensitivity(i, edrumulus.read_setting(i, 2));
edrumulus.set_pos_threshold(i, edrumulus.read_setting(i, 3));
edrumulus.set_pos_sensitivity(i, edrumulus.read_setting(i, 4));
edrumulus.set_rim_shot_threshold(i, edrumulus.read_setting(i, 5));
edrumulus.set_curve(i, static_cast<Pad::Ecurvetype>(edrumulus.read_setting(i, 6)));
edrumulus.set_rim_shot_is_used(i, edrumulus.read_setting(i, 7));
edrumulus.set_pos_sense_is_used(i, edrumulus.read_setting(i, 8));
edrumulus.set_midi_note_norm(i, edrumulus.read_setting(i, 9));
edrumulus.set_midi_note_rim(i, edrumulus.read_setting(i, 10));
edrumulus.set_cancellation(i, edrumulus.read_setting(i, 11));
edrumulus.set_midi_note_open_norm(i, edrumulus.read_setting(i, 12));
edrumulus.set_midi_note_open_rim(i, edrumulus.read_setting(i, 13));
edrumulus.set_mask_time(i, edrumulus.read_setting(i, 14));
edrumulus.set_rim_shot_boost(i, edrumulus.read_setting(i, 15));
edrumulus.set_coupled_pad_idx(i, edrumulus.read_setting(i, 16));
edrumulus.set_rim_pos_threshold(i, edrumulus.read_setting(i, 17));
edrumulus.set_rim_pos_sensitivity(i, edrumulus.read_setting(i, 18));
}
edrumulus.set_spike_cancel_level(edrumulus.read_setting(number_pads, 0));
}
void write_all_settings()
{
for (int i = 0; i < number_pads; i++)
{
edrumulus.write_setting(i, 0, edrumulus.get_pad_type(i));
edrumulus.write_setting(i, 1, edrumulus.get_velocity_threshold(i));
edrumulus.write_setting(i, 2, edrumulus.get_velocity_sensitivity(i));
edrumulus.write_setting(i, 3, edrumulus.get_pos_threshold(i));
edrumulus.write_setting(i, 4, edrumulus.get_pos_sensitivity(i));
edrumulus.write_setting(i, 5, edrumulus.get_rim_shot_threshold(i));
edrumulus.write_setting(i, 6, edrumulus.get_curve(i));
edrumulus.write_setting(i, 7, edrumulus.get_rim_shot_is_used(i));
edrumulus.write_setting(i, 8, edrumulus.get_pos_sense_is_used(i));
edrumulus.write_setting(i, 9, edrumulus.get_midi_note_norm(i));
edrumulus.write_setting(i, 10, edrumulus.get_midi_note_rim(i));
edrumulus.write_setting(i, 11, edrumulus.get_cancellation(i));
edrumulus.write_setting(i, 12, edrumulus.get_midi_note_open_norm(i));
edrumulus.write_setting(i, 13, edrumulus.get_midi_note_open_rim(i));
edrumulus.write_setting(i, 14, edrumulus.get_mask_time(i));
edrumulus.write_setting(i, 15, edrumulus.get_rim_shot_boost(i));
edrumulus.write_setting(i, 16, edrumulus.get_coupled_pad_idx(i));
edrumulus.write_setting(i, 17, edrumulus.get_rim_pos_threshold(i));
edrumulus.write_setting(i, 18, edrumulus.get_rim_pos_sensitivity(i));
}
edrumulus.write_setting(number_pads, 0, edrumulus.get_spike_cancel_level());
}