Skip to content

bug: Metronome sync issues (accent drift + startup offset) #13

@ElBeh

Description

@ElBeh

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:

  1. Load a song with BPM (audio or dummy + GP)
  2. Enable metronome, start playback
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions