-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathparameters.cpp
402 lines (372 loc) · 18.3 KB
/
parameters.cpp
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
/******************************************************************************\
* 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
\******************************************************************************/
#include "edrumulus.h"
void Pad::apply_preset_pad_settings()
{
// apply PRESET settings (might be overwritten by pad-specific properties)
pad_settings.velocity_threshold = 8; // 0..31
pad_settings.velocity_sensitivity = 9; // 0..31
pad_settings.mask_time_ms = 6; // 0..31 (ms)
pad_settings.pos_threshold = 9; // 0..31
pad_settings.pos_sensitivity = 14; // 0..31
pad_settings.rim_pos_threshold = 25; // 0..31
pad_settings.rim_pos_sensitivity = 15; // 0..31
pad_settings.rim_shot_threshold = 12; // 0..31
pad_settings.rim_shot_boost = 15; // 0..31
pad_settings.cancellation = 0; // 0..31
pad_settings.coupled_pad_idx = 0; // 0..[number of pads - 1] (0 means disabled)
pad_settings.curve_type = LINEAR;
pad_settings.is_control = false; // default is a normal pad
pad_settings.is_rim_switch = false; // default is a piezo for the rim sensor
pad_settings.pos_sense_is_used = false; // must be explicitely enabled if it shall be used
pad_settings.rim_shot_is_used = false; // must be explicitely enabled if it shall be used
pad_settings.first_peak_diff_thresh_db = 8.0f; // pad specific parameter: allowed difference between first peak and later peak in scan time
pad_settings.mask_time_decay_fact_db = 15.0f; // pad specific parameter: during mask time decay factor for maximum peak in scan time
pad_settings.scan_time_ms = 2.5f; // pad specific parameter: scan time after first detected peak
pad_settings.pre_scan_time_ms = 2.5f; // pad specific parameter: pre-scan time to search for first peak
pad_settings.decay_est_delay_ms = 7.0f; // pad specific parameter: delay after second main peak until decay power estimation starts
pad_settings.decay_est_len_ms = 4.0f; // pad specific parameter: decay power estimation window length
pad_settings.decay_est_fact_db = 16.0f; // pad specific parameter: decay power estimation factor (to get over decay ripple)
pad_settings.decay_fact_db = 1.0f; // pad specific parameter: vertical shift of the decay function in dB
pad_settings.decay_len1_ms = 0.0f; // pad specific parameter: length of the decay 1
pad_settings.decay_grad_fact1 = 200.0f; // pad specific parameter: decay function gradient factor 1
pad_settings.decay_len2_ms = 350.0f; // pad specific parameter: length of the decay 2
pad_settings.decay_grad_fact2 = 200.0f; // pad specific parameter: decay function gradient factor 2
pad_settings.decay_len3_ms = 0.0f; // pad specific parameter: length of the decay 3
pad_settings.decay_grad_fact3 = 200.0f; // pad specific parameter: decay function gradient factor 3
pad_settings.pos_low_pass_cutoff = 150.0f; // pad specific parameter: low-pass filter cut-off in Hz for positional sensing
pad_settings.pos_invert = false; // pad specific parameter: invert the positional sensing metric
pad_settings.rim_use_low_freq_bp = true; // pad specific parameter: use low frequency band-pass filter for rim shot detection
pad_settings.rim_shot_window_len_ms = 3.5f; // pad specific parameter: window length for rim shot detection
pad_settings.clip_comp_ampmap_step = 0.08f; // pad specific parameter: clipping compensation amplitude mapping step, conservative value from PD80R as default
switch (pad_settings.pad_type)
{
// Mesh pads ---------------------------------------------------------------
case PD120: // dual trigger
pad_settings.velocity_threshold = 6;
pad_settings.velocity_sensitivity = 6;
pad_settings.pos_threshold = 7;
pad_settings.pos_sensitivity = 14;
pad_settings.rim_pos_threshold = 20;
pad_settings.rim_pos_sensitivity = 10;
pad_settings.rim_shot_threshold = 24;
pad_settings.pos_sense_is_used = true;
pad_settings.rim_shot_is_used = true;
break;
case PD80R: // dual trigger
pad_settings.velocity_sensitivity = 1;
pad_settings.rim_shot_threshold = 10;
pad_settings.pos_threshold = 9;
pad_settings.pos_sensitivity = 15;
pad_settings.rim_pos_threshold = 14;
pad_settings.rim_pos_sensitivity = 15;
pad_settings.scan_time_ms = 3.0f;
pad_settings.decay_len2_ms = 75.0f;
pad_settings.decay_grad_fact2 = 300.0f;
pad_settings.decay_len3_ms = 300.0f;
pad_settings.decay_grad_fact3 = 100.0f;
pad_settings.rim_use_low_freq_bp = false;
pad_settings.pos_sense_is_used = true;
pad_settings.rim_shot_is_used = true;
break;
case PDA120LS: // dual trigger
pad_settings.velocity_threshold = 11;
pad_settings.velocity_sensitivity = 7;
pad_settings.pos_threshold = 31;
pad_settings.pos_sensitivity = 16;
pad_settings.rim_shot_threshold = 30;
pad_settings.decay_grad_fact2 = 250.0f;
pad_settings.decay_fact_db = 5.0f;
pad_settings.pre_scan_time_ms = 3.5f;
pad_settings.first_peak_diff_thresh_db = 7.0f;
pad_settings.pos_invert = true;
pad_settings.pos_sense_is_used = true;
pad_settings.rim_shot_is_used = true;
break;
case PDX100:
pad_settings.velocity_threshold = 6;
pad_settings.velocity_sensitivity = 5;
pad_settings.pos_threshold = 9;
pad_settings.pos_sensitivity = 16;
pad_settings.rim_shot_threshold = 24;
pad_settings.decay_fact_db = 2.0f;
pad_settings.decay_len2_ms = 65.0f;
pad_settings.decay_grad_fact2 = 300.0f;
pad_settings.decay_len3_ms = 350.0f;
pad_settings.decay_grad_fact3 = 150.0f;
pad_settings.pos_low_pass_cutoff = 120.0f;
pad_settings.pos_sense_is_used = true;
pad_settings.rim_shot_is_used = true;
break;
case PDX8:
pad_settings.velocity_threshold = 6;
pad_settings.velocity_sensitivity = 4;
pad_settings.rim_shot_threshold = 14;
pad_settings.pos_threshold = 21;
pad_settings.pos_sensitivity = 27;
pad_settings.pos_sense_is_used = true;
pad_settings.rim_shot_is_used = true;
break;
case DIABOLO12:
pad_settings.scan_time_ms = 2.0f;
pad_settings.mask_time_ms = 8.0f;
pad_settings.first_peak_diff_thresh_db = 13.0f;
pad_settings.mask_time_decay_fact_db = 20.0f;
pad_settings.decay_grad_fact2 = 270.0f;
pad_settings.decay_fact_db = 6.0f;
pad_settings.decay_est_delay_ms = 20.0f;
pad_settings.pos_low_pass_cutoff = 50.0f; // positional sensing seems not to work correctly
pad_settings.pos_sense_is_used = true;
pad_settings.rim_shot_is_used = true;
break;
case MPS750X_SNARE: // dual trigger
pad_settings.scan_time_ms = 6.0f;
pad_settings.pre_scan_time_ms = 3.5f;
pad_settings.decay_grad_fact2 = 150.0f;
pad_settings.decay_len2_ms = 450.0f;
pad_settings.rim_use_low_freq_bp = false;
pad_settings.rim_shot_is_used = true;
pad_settings.rim_shot_threshold = 12;
pad_settings.velocity_threshold = 2;
pad_settings.velocity_sensitivity = 6;
pad_settings.pos_sense_is_used = true;
pad_settings.pos_sensitivity = 3;
break;
case MPS750X_TOM: // dual trigger
pad_settings.scan_time_ms = 6.0f;
pad_settings.pre_scan_time_ms = 3.5f;
pad_settings.decay_grad_fact2 = 150.0f;
pad_settings.decay_len2_ms = 450.0f;
pad_settings.rim_shot_is_used = false;
pad_settings.velocity_threshold = 2;
pad_settings.velocity_sensitivity = 3;
break;
// Rubber pads -------------------------------------------------------------
case PD5: // single trigger
pad_settings.scan_time_ms = 4.0f;
pad_settings.mask_time_ms = 9.0f;
pad_settings.decay_grad_fact2 = 400.0f;
break;
case PD6: // single trigger
pad_settings.velocity_sensitivity = 4;
pad_settings.scan_time_ms = 1.5f;
pad_settings.decay_grad_fact2 = 400.0f;
break;
case PD8: // dual trigger
pad_settings.is_rim_switch = true;
pad_settings.velocity_sensitivity = 3;
pad_settings.pos_threshold = 26;
pad_settings.pos_sensitivity = 11;
pad_settings.rim_shot_threshold = 22;
pad_settings.mask_time_ms = 7;
pad_settings.scan_time_ms = 1.3f;
pad_settings.decay_est_delay_ms = 6.0f;
pad_settings.decay_fact_db = 5.0f;
pad_settings.decay_len2_ms = 30.0f;
pad_settings.decay_grad_fact2 = 600.0f;
pad_settings.decay_len3_ms = 150.0f;
pad_settings.decay_grad_fact3 = 120.0f;
pad_settings.pos_sense_is_used = true;
pad_settings.rim_shot_is_used = true;
pad_settings.clip_comp_ampmap_step = 0.4f;
break;
case TP80: // single trigger
pad_settings.velocity_sensitivity = 8;
pad_settings.pos_threshold = 27;
pad_settings.pos_sensitivity = 19;
pad_settings.scan_time_ms = 2.75f;
pad_settings.decay_est_delay_ms = 11.0f;
pad_settings.decay_len2_ms = 60.0f;
pad_settings.decay_grad_fact2 = 400.0f;
pad_settings.decay_len3_ms = 700.0f;
pad_settings.decay_grad_fact3 = 60.0f;
pad_settings.pos_invert = true;
pad_settings.pos_sense_is_used = true;
break;
case HD1TOM: // single trigger
pad_settings.velocity_threshold = 8;
pad_settings.velocity_sensitivity = 5;
pad_settings.curve_type = LOG1;
pad_settings.scan_time_ms = 1.5f;
pad_settings.decay_grad_fact2 = 300.0f;
pad_settings.pos_low_pass_cutoff = 300.0f;
break;
// Kick drum pads ----------------------------------------------------------
case KD7: // single trigger
pad_settings.velocity_threshold = 11;
pad_settings.velocity_sensitivity = 6;
pad_settings.curve_type = LOG2; // less dynamic on kick (similar to other drum modules)
pad_settings.scan_time_ms = 2.0f;
pad_settings.decay_est_delay_ms = 8.0f;
pad_settings.decay_fact_db = 5.0f;
pad_settings.decay_len1_ms = 4.0f;
pad_settings.decay_grad_fact1 = 30.0f;
pad_settings.decay_len2_ms = 30.0f;
pad_settings.decay_grad_fact2 = 450.0f;
pad_settings.decay_len3_ms = 500.0f;
pad_settings.decay_grad_fact3 = 45.0f;
break;
case KD8: // single trigger
pad_settings.velocity_sensitivity = 2;
pad_settings.curve_type = LOG2; // less dynamic on kick (similar to other drum modules)
pad_settings.scan_time_ms = 3.0f;
pad_settings.mask_time_decay_fact_db = 10.0f;
pad_settings.decay_grad_fact2 = 450.0f;
pad_settings.decay_len3_ms = 500.0f;
pad_settings.decay_grad_fact3 = 45.0f;
break;
case KT10: // single trigger
pad_settings.velocity_sensitivity = 6;
pad_settings.scan_time_ms = 2.0f;
pad_settings.decay_est_delay_ms = 8.0f;
pad_settings.decay_fact_db = 5.0f;
pad_settings.decay_len1_ms = 4.0f;
pad_settings.decay_grad_fact1 = 30.0f;
pad_settings.decay_len2_ms = 30.0f;
pad_settings.decay_grad_fact2 = 350.0f;
pad_settings.decay_len3_ms = 500.0f;
pad_settings.decay_grad_fact3 = 100.0f;
break;
case KD120: // single trigger
pad_settings.scan_time_ms = 6.0f;
pad_settings.decay_fact_db = 12.0f;
pad_settings.decay_est_fact_db = 20.0f;
break;
case MPS750X_KICK: // single trigger
pad_settings.first_peak_diff_thresh_db = 3.0f;
pad_settings.scan_time_ms = 6.0f;
pad_settings.pre_scan_time_ms = 3.5f;
pad_settings.decay_grad_fact2 = 150.0f;
pad_settings.decay_len2_ms = 450.0f;
pad_settings.velocity_threshold = 10;
pad_settings.velocity_sensitivity = 10;
pad_settings.curve_type = LOG2;
break;
// Cymbal pads -------------------------------------------------------------
case CY5: // dual trigger
pad_settings.is_rim_switch = true;
pad_settings.velocity_threshold = 6;
pad_settings.velocity_sensitivity = 4;
pad_settings.rim_shot_threshold = 12;
pad_settings.rim_shot_boost = 0;
pad_settings.scan_time_ms = 3.0f;
pad_settings.mask_time_ms = 8.0f;
pad_settings.decay_fact_db = 3.0f;
pad_settings.rim_shot_is_used = true;
break;
case CY6: // dual trigger
pad_settings.is_rim_switch = true;
pad_settings.velocity_sensitivity = 6;
pad_settings.rim_shot_threshold = 12;
pad_settings.rim_shot_boost = 0;
pad_settings.scan_time_ms = 6.0f;
pad_settings.decay_len2_ms = 150.0f;
pad_settings.decay_grad_fact2 = 120.0f;
pad_settings.decay_len3_ms = 450.0f;
pad_settings.decay_grad_fact3 = 30.0f;
pad_settings.rim_shot_is_used = true;
break;
case CY8: // dual trigger
pad_settings.is_rim_switch = true;
pad_settings.velocity_threshold = 10;
pad_settings.velocity_sensitivity = 5;
pad_settings.rim_shot_threshold = 10;
pad_settings.rim_shot_boost = 0;
pad_settings.curve_type = LOG2;
pad_settings.scan_time_ms = 6.0f;
pad_settings.decay_len1_ms = 10.0f;
pad_settings.decay_grad_fact1 = 10.0f;
pad_settings.decay_len2_ms = 100.0f;
pad_settings.decay_grad_fact2 = 200.0f;
pad_settings.decay_len3_ms = 450.0f;
pad_settings.decay_grad_fact3 = 30.0f;
pad_settings.rim_shot_is_used = true;
break;
case VH12: // dual trigger
// TODO if the Hi-Hat is open just a little bit, we get double triggers
pad_settings.is_rim_switch = true;
pad_settings.velocity_sensitivity = 5;
pad_settings.rim_shot_threshold = 23;
pad_settings.rim_shot_boost = 0;
pad_settings.scan_time_ms = 4.0f;
pad_settings.decay_est_delay_ms = 9.0f;
pad_settings.decay_fact_db = 5.0f;
pad_settings.decay_len2_ms = 27.0f;
pad_settings.decay_grad_fact2 = 700.0f;
pad_settings.decay_len3_ms = 600.0f; // must be long because of open Hi-Hat ringing
pad_settings.decay_grad_fact3 = 75.0f;
break;
case LEHHS12C: // dual trigger (Lemon HHC12)
pad_settings.is_rim_switch = true;
pad_settings.scan_time_ms = 4.0f;
pad_settings.decay_fact_db = 5.0f;
pad_settings.decay_len2_ms = 600.0f;
pad_settings.decay_grad_fact2 = 100.0f;
pad_settings.rim_shot_is_used = true;
pad_settings.rim_shot_threshold = 25;
pad_settings.rim_shot_boost = 0;
pad_settings.velocity_threshold = 18;
pad_settings.velocity_sensitivity = 6;
break;
case MPS750X_RIDE: // 3-zone
pad_settings.is_rim_switch = true;
pad_settings.scan_time_ms = 3.0f;
pad_settings.decay_est_delay_ms = 1.0f;
pad_settings.decay_grad_fact2 = 150.0f;
pad_settings.decay_len2_ms = 450.0f;
pad_settings.rim_use_low_freq_bp = false;
pad_settings.rim_shot_is_used = true;
pad_settings.rim_shot_threshold = 18;
pad_settings.rim_shot_boost = 0;
pad_settings.velocity_threshold = 12;
pad_settings.velocity_sensitivity = 6;
break;
case MPS750X_CRASH: // 2-zone
pad_settings.is_rim_switch = true;
pad_settings.scan_time_ms = 3.0f;
pad_settings.decay_est_delay_ms = 1.0f;
pad_settings.decay_grad_fact2 = 150.0f;
pad_settings.decay_len2_ms = 450.0f;
pad_settings.rim_use_low_freq_bp = false;
pad_settings.rim_shot_is_used = true;
pad_settings.rim_shot_threshold = 20;
pad_settings.rim_shot_boost = 0;
pad_settings.velocity_threshold = 12;
pad_settings.velocity_sensitivity = 6;
break;
// Hi-hat controllers ------------------------------------------------------
case FD8:
pad_settings.is_control = true;
pad_settings.pos_threshold = 5;
pad_settings.pos_sensitivity = 0;
pad_settings.velocity_threshold = 9; // pedal stomp configuration
pad_settings.velocity_sensitivity = 11; // pedal stomp configuration
break;
case VH12CTRL:
pad_settings.is_control = true;
pad_settings.pos_threshold = 19;
pad_settings.pos_sensitivity = 28;
break;
case LEHHS12C_CTRL: // 0-35k poti
pad_settings.is_control = true;
pad_settings.pos_threshold = 6;
pad_settings.pos_sensitivity = 23;
pad_settings.velocity_threshold = 0;
pad_settings.velocity_sensitivity = 22;
break;
}
}