Description
Two related sync issues with the metronome:
1. Accent misaligned after pause/resume
After pausing and resuming playback, the metronome sometimes restarts with the
accent (beat 1) at the wrong position in the bar. The click continues at the
correct tempo but the accent drifts from the actual downbeat.
Steps to Reproduce:
- Load a song with BPM (audio or dummy + GP)
- Enable metronome, start playback
- Pause mid-bar, resume → accent may land on wrong beat
Root Cause: startBeatInBar is computed from React refs that may not
reflect the exact pause position due to effect timing.
2. Metronome out of sync with GP file on initial play
The metronome starts immediately when the play effect fires, but alphaSynth
has a short startup latency before producing the first note. This causes a
persistent offset. Additionally, GP files with anacrusis (pickup bar) or
leading rests shift the actual downbeat relative to tick 0.
Manually seeking to the first note of a bar aligns the metronome correctly,
confirming the offset is a startup issue.
Possible Approach: Sync the metronome start to the first alphaSynth
position callback rather than starting it proactively in the React effect.
Description
Two related sync issues with the metronome:
1. Accent misaligned after pause/resume
After pausing and resuming playback, the metronome sometimes restarts with the
accent (beat 1) at the wrong position in the bar. The click continues at the
correct tempo but the accent drifts from the actual downbeat.
Steps to Reproduce:
Root Cause:
startBeatInBaris computed from React refs that may notreflect the exact pause position due to effect timing.
2. Metronome out of sync with GP file on initial play
The metronome starts immediately when the play effect fires, but alphaSynth
has a short startup latency before producing the first note. This causes a
persistent offset. Additionally, GP files with anacrusis (pickup bar) or
leading rests shift the actual downbeat relative to tick 0.
Manually seeking to the first note of a bar aligns the metronome correctly,
confirming the offset is a startup issue.
Possible Approach: Sync the metronome start to the first alphaSynth
position callback rather than starting it proactively in the React effect.