From 2d88e18008a46e639eb8d65ccf3da952951d591a Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Tue, 14 Nov 2023 21:20:48 +0100 Subject: [PATCH] fixed a typo: treshold -> threshold --- edrumulus.cpp | 10 +++++----- edrumulus.h | 14 +++++++------- edrumulus.ino | 12 ++++++------ edrumulus_parameters.cpp | 22 +++++++++++----------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/edrumulus.cpp b/edrumulus.cpp index b111ee2..ea6abea 100644 --- a/edrumulus.cpp +++ b/edrumulus.cpp @@ -506,10 +506,10 @@ void Edrumulus::Pad::initialize() decay_est_delay = round ( pad_settings.decay_est_delay_ms * 1e-3f * Fs ); decay_est_len = round ( pad_settings.decay_est_len_ms * 1e-3f * Fs ); decay_est_fact = pow ( 10.0f, pad_settings.decay_est_fact_db / 10 ); - rim_shot_treshold = pow ( 10.0f, ( static_cast ( pad_settings.rim_shot_treshold ) - 44 ) / 10 ); // linear rim shot threshold + rim_shot_threshold = pow ( 10.0f, ( static_cast ( pad_settings.rim_shot_threshold ) - 44 ) / 10 ); // linear rim shot threshold rim_shot_window_len = round ( pad_settings.rim_shot_window_len_ms * 1e-3f * Fs ); // window length (e.g. 5 ms) rim_shot_boost = pow ( 10.0f, static_cast ( pad_settings.rim_shot_boost ) / 40 ); // boost / 4 -> dB value - rim_switch_treshold = -pow ( 10.0f, pad_settings.rim_shot_treshold / 10.0f ); // rim switch linear threshold, where 10^(31/10)=1259 which is approx 4096/3 (10 bit ADC) + rim_switch_threshold = -pow ( 10.0f, pad_settings.rim_shot_threshold / 10.0f ); // rim switch linear threshold, where 10^(31/10)=1259 which is approx 4096/3 (10 bit ADC) rim_switch_on_cnt_thresh = round ( 10.0f * 1e-3f * Fs ); // number of on samples until we detect a choke 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 x_rim_hist_len = x_sq_hist_len + rim_shot_window_len; @@ -1112,13 +1112,13 @@ Serial.println ( String ( sqrt ( left_neighbor ) ) + " " + String ( sqrt ( right if ( get_is_rim_switch() ) { // as a quick hack we re-use the length parameter for the switch on detection - const bool rim_switch_on = ( input[1] < rim_switch_treshold ); + const bool rim_switch_on = ( input[1] < rim_switch_threshold ); s.x_rim_switch_hist.add ( rim_switch_on ); if ( use_second_rim && ( input_len > 2 ) ) { // the second rim signal is on third input signal - s.x_sec_rim_switch_hist.add ( input[2] < rim_switch_treshold ); + s.x_sec_rim_switch_hist.add ( input[2] < rim_switch_threshold ); } // at the end of the scan time search the history buffer for any switch on @@ -1242,7 +1242,7 @@ Serial.println ( String ( sqrt ( left_neighbor ) ) + " " + String ( sqrt ( right } const float rim_metric = rim_max_pow / s.peak_val; - const bool is_rim_shot = ( rim_metric > rim_shot_treshold ) && ( rim_max_pow > rim_max_power_low_limit ); + const bool is_rim_shot = ( rim_metric > rim_shot_threshold ) && ( rim_max_pow > rim_max_power_low_limit ); s.rim_state = is_rim_shot ? RIM_SHOT : NO_RIM; s.rim_shot_cnt = 0; s.was_rim_shot_ready = true; diff --git a/edrumulus.h b/edrumulus.h index 63b2b27..971c8ec 100644 --- a/edrumulus.h +++ b/edrumulus.h @@ -178,8 +178,8 @@ class Edrumulus int get_pos_sensitivity ( const int pad_idx ) { return pad[pad_idx].get_pos_sensitivity(); } void set_mask_time ( const int pad_idx, const int new_time ) { pad[pad_idx].set_mask_time ( new_time ); } int get_mask_time ( const int pad_idx ) { return pad[pad_idx].get_mask_time(); } - void set_rim_shot_treshold ( const int pad_idx, const int new_threshold ) { pad[pad_idx].set_rim_shot_treshold ( new_threshold ); } - int get_rim_shot_treshold ( const int pad_idx ) { return pad[pad_idx].get_rim_shot_treshold(); } + void set_rim_shot_threshold ( const int pad_idx, const int new_threshold ) { pad[pad_idx].set_rim_shot_threshold ( new_threshold ); } + int get_rim_shot_threshold ( const int pad_idx ) { return pad[pad_idx].get_rim_shot_threshold(); } void set_rim_shot_boost ( const int pad_idx, const int new_boost ) { pad[pad_idx].set_rim_shot_boost ( new_boost ); } int get_rim_shot_boost ( const int pad_idx ) { return pad[pad_idx].get_rim_shot_boost(); } void set_curve ( const int pad_idx, const Ecurvetype new_curve ) { pad[pad_idx].set_curve ( new_curve ); } @@ -264,8 +264,8 @@ class Edrumulus int get_pos_sensitivity () { return pad_settings.pos_sensitivity; } void set_mask_time ( const int new_time_ms ) { pad_settings.mask_time_ms = new_time_ms; sched_init(); } int get_mask_time () { return pad_settings.mask_time_ms; } - void set_rim_shot_treshold ( const int new_threshold ) { pad_settings.rim_shot_treshold = new_threshold; sched_init(); } - int get_rim_shot_treshold () { return pad_settings.rim_shot_treshold; } + void set_rim_shot_threshold ( const int new_threshold ) { pad_settings.rim_shot_threshold = new_threshold; sched_init(); } + int get_rim_shot_threshold () { return pad_settings.rim_shot_threshold; } void set_rim_shot_boost ( const int new_boost ) { pad_settings.rim_shot_boost = new_boost; sched_init(); } int get_rim_shot_boost () { return pad_settings.rim_shot_boost; } void set_curve ( const Ecurvetype new_curve ) { pad_settings.curve_type = new_curve; sched_init(); } @@ -295,7 +295,7 @@ class Edrumulus int mask_time_ms; // 0..31 (ms) int pos_threshold; // 0..31 int pos_sensitivity; // 0..31, high values give higher sensitivity - int rim_shot_treshold; // 0..31 + int rim_shot_threshold; // 0..31 int rim_shot_boost; // 0..31 int cancellation; // 0..31 int coupled_pad_idx; // 0..[number of pads - 1] @@ -436,9 +436,9 @@ const float ADC_noise_peak_velocity_scaling = 1.0f / 6.0f; float decay_mask_fact; int x_rim_hist_len; int rim_shot_window_len; - float rim_shot_treshold; + float rim_shot_threshold; float rim_shot_boost; - float rim_switch_treshold; + float rim_switch_threshold; int rim_switch_on_cnt_thresh; int lp_filt_len; int x_low_hist_len; diff --git a/edrumulus.ino b/edrumulus.ino index 24646a7..3e25701 100644 --- a/edrumulus.ino +++ b/edrumulus.ino @@ -294,9 +294,9 @@ void loop() // controller 107: rim shot threshold if ( controller == 107 ) { - edrumulus.set_rim_shot_treshold ( selected_pad, value ); - edrumulus.write_setting ( selected_pad, 5, value ); - confirm_setting ( controller, value, false ); + edrumulus.set_rim_shot_threshold ( selected_pad, value ); + edrumulus.write_setting ( selected_pad, 5, value ); + confirm_setting ( controller, value, false ); } // controller 108: select pad @@ -448,7 +448,7 @@ void confirm_setting ( const int controller, 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_treshold ( 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 ( edrumulus.get_curve ( selected_pad ) ), 1 ); MYMIDI.sendNoteOff ( 110, edrumulus.get_spike_cancel_level(), 1 ); @@ -484,7 +484,7 @@ void read_settings() 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_treshold ( i, edrumulus.read_setting ( i, 5 ) ); + edrumulus.set_rim_shot_threshold ( i, edrumulus.read_setting ( i, 5 ) ); edrumulus.set_curve ( i, static_cast ( 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 ) ); @@ -510,7 +510,7 @@ void write_all_settings() 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_treshold ( 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 ) ); diff --git a/edrumulus_parameters.cpp b/edrumulus_parameters.cpp index 21c42b1..f18c6ac 100644 --- a/edrumulus_parameters.cpp +++ b/edrumulus_parameters.cpp @@ -26,7 +26,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() 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_shot_treshold = 12; // 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) @@ -62,7 +62,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() pad_settings.velocity_sensitivity = 6; pad_settings.pos_threshold = 7; pad_settings.pos_sensitivity = 14; - pad_settings.rim_shot_treshold = 24; + pad_settings.rim_shot_threshold = 24; pad_settings.pos_sense_is_used = true; pad_settings.rim_shot_is_used = true; break; @@ -72,7 +72,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() pad_settings.velocity_sensitivity = 7; pad_settings.pos_threshold = 31; pad_settings.pos_sensitivity = 16; - pad_settings.rim_shot_treshold = 30; + 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; @@ -84,7 +84,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() case PD80R: // dual trigger pad_settings.velocity_sensitivity = 1; - pad_settings.rim_shot_treshold = 10; + pad_settings.rim_shot_threshold = 10; pad_settings.pos_threshold = 11; pad_settings.pos_sensitivity = 10; pad_settings.scan_time_ms = 3.0f; @@ -102,7 +102,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() pad_settings.velocity_sensitivity = 5; pad_settings.pos_threshold = 9; pad_settings.pos_sensitivity = 16; - pad_settings.rim_shot_treshold = 24; + 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; @@ -116,7 +116,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() case PDX8: pad_settings.velocity_threshold = 6; pad_settings.velocity_sensitivity = 4; - pad_settings.rim_shot_treshold = 14; + pad_settings.rim_shot_threshold = 14; pad_settings.pos_threshold = 21; pad_settings.pos_sensitivity = 27; pad_settings.pos_sense_is_used = true; @@ -140,7 +140,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() pad_settings.velocity_sensitivity = 3; pad_settings.pos_threshold = 26; pad_settings.pos_sensitivity = 11; - pad_settings.rim_shot_treshold = 22; + 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; @@ -180,7 +180,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() // 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_treshold = 23; + 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; @@ -245,7 +245,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() pad_settings.is_rim_switch = true; pad_settings.velocity_threshold = 6; pad_settings.velocity_sensitivity = 4; - pad_settings.rim_shot_treshold = 12; + 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; @@ -256,7 +256,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() case CY6: // dual trigger pad_settings.is_rim_switch = true; pad_settings.velocity_sensitivity = 6; - pad_settings.rim_shot_treshold = 12; + 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; @@ -270,7 +270,7 @@ void Edrumulus::Pad::apply_preset_pad_settings() pad_settings.is_rim_switch = true; pad_settings.velocity_threshold = 10; pad_settings.velocity_sensitivity = 5; - pad_settings.rim_shot_treshold = 10; + pad_settings.rim_shot_threshold = 10; pad_settings.rim_shot_boost = 0; pad_settings.curve_type = LOG2; pad_settings.scan_time_ms = 6.0f;