Skip to content

Commit ff1bd93

Browse files
committed
make the hi-hat pedal stomp parameters adjustable in the GUI with the thres and sense parameters
1 parent 37ff13f commit ff1bd93

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

edrumulus.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,7 @@ void Edrumulus::Pad::initialize()
514514
rim_max_power_low_limit = ADC_MAX_NOISE_AMPL * ADC_MAX_NOISE_AMPL / 31.0f; // lower limit on detected rim power, 15 dB below max noise amplitude
515515
x_rim_hist_len = x_sq_hist_len + rim_shot_window_len;
516516
cancellation_factor = static_cast<float> ( pad_settings.cancellation ) / 31.0f; // cancellation factor: range of 0.0..1.0
517-
ctrl_history_len = 10; // (MUST BE AN EVEN VALUE) control history length, use a fixed value
518517
ctrl_history_len_half = ctrl_history_len / 2;
519-
ctrl_velocity_range_fact = 20.0f; // use a fixed value (TODO make it adjustable)
520-
ctrl_velocity_threshold = 1.0f; // use a fixed value (TODO make it adjustable)
521518
max_num_overloads = 3; // maximum allowed number of overloaded samples until the overload special case is activated
522519

523520
// The ESP32 ADC has 12 bits resulting in a range of 20*log10(2048)=66.2 dB.
@@ -562,6 +559,10 @@ void Edrumulus::Pad::initialize()
562559
control_threshold = pad_settings.pos_threshold / 31.0f * ( 0.6f * ADC_MAX_RANGE ) + ( 0.1f * ADC_MAX_RANGE );
563560
control_range = ( ADC_MAX_RANGE - control_threshold ) * ( 32 - pad_settings.pos_sensitivity ) / 32;
564561

562+
// hi-hat pedal stomp action parameters
563+
ctrl_velocity_range_fact = pow ( 10.0f, pad_settings.velocity_sensitivity / 1.8f / 10.0f ); // linear range of 1..53
564+
ctrl_velocity_threshold = pow ( 10.0f, pad_settings.velocity_threshold / 3.0f / 10.0f ) - 1; // linear range of 0..10
565+
565566
// positional sensing low-pass filter properties
566567
// moving average cut off frequency approximation according to:
567568
// https://dsp.stackexchange.com/questions/9966/what-is-the-cut-off-frequency-of-a-moving-average-filter

edrumulus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ class Edrumulus
327327
void sched_init() { init_delay_cnt = init_delay_value; }; // schedule initialization function (for delayed initialization)
328328
const float init_delay_value_s = 0.2; // init delay value in seconds
329329
static const int length_ampmap = 20; // maxmimum number of amplification mappings for clipping compensation
330+
static const int ctrl_history_len = 10; // (MUST BE AN EVEN VALUE) control history length, use a fixed value
330331

331332
// band-pass filter coefficients (they are constant and must not be changed)
332333
const int bp_filt_len = 5;
@@ -447,7 +448,6 @@ const float ADC_noise_peak_velocity_scaling = 1.0f / 6.0f;
447448
int midi_note_open;
448449
int midi_note_open_rim;
449450
int midi_ctrl_ch;
450-
int ctrl_history_len;
451451
int ctrl_history_len_half;
452452
float ctrl_velocity_threshold;
453453
float ctrl_velocity_range_fact;

tools/settings/trigger_settings.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
2,120,0
5151
2,110,4
5252
3,102,3
53-
3,103,5
54-
3,104,0
53+
3,103,9
54+
3,104,20
5555
3,105,5
5656
3,106,0
5757
3,107,12

0 commit comments

Comments
 (0)