Skip to content

Commit

Permalink
Fixes bug in GetEventsAroundMaxima
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Apr 9, 2021
1 parent d0e2cba commit 041342e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/AudioAnalysisTools/AcousticEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,15 @@ public static List<AcousticEvent> GetEventsAroundMaxima(
i = maxFrame;
while (values[i] > thresholdValue)
{
i++;
// AT: added this condition otherwise index can grow larger than values array
if (i + 1 < values.Length)
{
i++;
}
else
{
break;
}
}

endFrame = i;
Expand Down

0 comments on commit 041342e

Please sign in to comment.