Skip to content

Commit

Permalink
improve rim shot detection for rim switch pads (try to solve issue wi…
Browse files Browse the repository at this point in the history
…th ESP32 crosstalk between ADC channels)
  • Loading branch information
corrados committed Apr 23, 2023
1 parent e01221c commit c6e1025
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions edrumulus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,13 +972,26 @@ Serial.println ( "idx: " + String ( peak_velocity_idx_in_overload_history ) + ",
// at the end of the scan time search the history buffer for any switch on
if ( s.was_peak_found )
{
s.stored_is_rimshot = false;
s.stored_is_rimshot = false;
int num_neighbor_switch_on = 0;

for ( int i = 0; i < rim_shot_window_len; i++ )
{
if ( s.x_rim_switch_hist[i] > 0 )
{
s.stored_is_rimshot = true;
num_neighbor_switch_on++;

// On the ESP32, we had seen crosstalk between head/rim inputs. To avoid that the interference
// signal from the head triggers the rim, we check that we have at least two neighbor samples
// above the rim threshold (the switch keeps on longer than the piezo signal)
if ( num_neighbor_switch_on >= 2 )
{
s.stored_is_rimshot = true;
}
}
else
{
num_neighbor_switch_on = 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion tools/settings/trigger_settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
0,104,4
0,105,26
0,106,11
0,107,10
0,107,15
0,109,0
0,110,4
0,111,3
Expand Down

0 comments on commit c6e1025

Please sign in to comment.