Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sakertooth
Copy link
Contributor

@sakertooth sakertooth commented Oct 18, 2025

This PR improves the Tap Tempo tool, refactoring its code and providing a more robust BPM calculation algorithm.

Changes

  • Refactoring the code to improve maintainability and code cleanliness (renaming functions, moving functionality outside of GUI code, removing friend access to TapTempoView, etc)
  • Improvements to the BPM algorithm
    1. Apply an EMA (exponential moving average, also known as exponential smoothing) filter to the BPM calculation. This helps minimize small rapid changes (jitter) in the BPM when tapping at sufficiently high tempos.
    2. Reset the calculated BPM after a long pause. A long pause most likely means the user stopped tapping, so we don't want to include that long interval in the BPM calculation.

@sakertooth sakertooth marked this pull request as ready for review October 18, 2025 21:06
@AW1534
Copy link
Member

AW1534 commented Nov 3, 2025

I've tested, and found no issues. This is definitely an improvement from master. I think perhaps there should be a label upon opening the tool saying something like "Click to begin".

@sakertooth
Copy link
Contributor Author

I've tested, and found no issues. This is definitely an improvement from master.

Thanks for testing!

I think perhaps there should be a label upon opening the tool saying something like "Click to begin".

Yeah, an indicator might be better UX. I'll look into adding that.

Early taps (as well as taps with high interval variance in general) need more responsive BPM updates so we can get to a target range quickly. Once we have reached the target BPM range, we want the BPM readings to become more stable as the user trying to tap with more consistency.

We use EMA to reduce jitter in the BPM readings, but the amount of smoothing we apply should change dynamically to align with how the user is tapping.

Adaptive EMA scaling adjusts the smoothing factor dynamically to account for this based on how much the tap intervals vary. If the variation is high, then the BPM updates are more responsive (allowing for rapid changes). If the variation is low, then the BPM updates are less responsive (slower, more stable changes).
@sakertooth
Copy link
Contributor Author

I added the "Click to begin" indicator as well as another major improvement to the BPM calculation @AW1534 👍

@AW1534
Copy link
Member

AW1534 commented Nov 5, 2025

The indicator is definitely a good improvement. I don't notice the difference to the BPM calculation, but i tested and it works well

@sakertooth
Copy link
Contributor Author

The indicator is definitely a good improvement. I don't notice the difference to the BPM calculation, but i tested and it works well

The problem was more noticeable in the beginning when trying to tap to a high tempo as it would take a long time for it to ramp up. I just added a feature that solves this to a certain degree.

So the metronome doesnt play the incorrect sound after a reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants