Skip to content

Commit

Permalink
fixed a typo: treshold -> threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
corrados committed Nov 14, 2023
1 parent fe6b175 commit 2d88e18
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions edrumulus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float> ( pad_settings.rim_shot_treshold ) - 44 ) / 10 ); // linear rim shot threshold
rim_shot_threshold = pow ( 10.0f, ( static_cast<float> ( 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<float> ( 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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions edrumulus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ); }
Expand Down Expand Up @@ -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(); }
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions edrumulus.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<int> ( edrumulus.get_curve ( selected_pad ) ), 1 );
MYMIDI.sendNoteOff ( 110, edrumulus.get_spike_cancel_level(), 1 );
Expand Down Expand Up @@ -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::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 ) );
Expand All @@ -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 ) );
Expand Down
22 changes: 11 additions & 11 deletions edrumulus_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 2d88e18

Please sign in to comment.