Skip to content

[Bug] Incorrect beaming and metronome desync on native pickup measures (anacrusis) #2871

Description

@AlbinoBJJ

Is there an existing issue for this?

  • I have searched the existing issues

I have read the contribution rules

AI authorship

AI-assisted (disclosure block included as described in AGENTS.md)

Current Behavior

[!NOTE]
AI-authored disclosure (alphatab-ai-authored-v1)
Portions of this content were authored by an AI agent. The agent has read

AGENTS.md and the human submitter accepts responsibility for compliance with the rules in that document.

Description of the Issue
When loading a score that contains a native anacrusis (a pickup measure / incomplete first measure without explicit rests inserted), two issues occur regarding notation rendering and audio playback synchronization:

Beaming / Visual Layout Bug:
In a 2/4 measure containing an anacrusis consisting of 3 eighth notes (where the measure is missing an implicit eighth rest on the first beat's downbeat), alphaTab aligns the first existing note to tick = 0. As a result, the first eighth note is incorrectly beamed with the second eighth note. Visually, the first note should render with an isolated stem/flag (representing the upbeat of beat 1), while the remaining two eighth notes should be beamed together on beat 2 (matching the layout in Guitar Pro 8).

Metronome & Count-In Audio Desync:
When activating the built-in metronome or scheduling a count-in, the metronome click for Beat 1 triggers precisely on the first sounding note of the pickup measure instead of aligning with the theoretical start of the measure. The audio engine treats the first available note as beat 1, leading to a complete phase offset where the metronome clicks and score playback remain out of sync throughout the score.

Note on testing: This bug consistently occurs across all scores containing a native pickup measure. However, scores where the editor manually inserted explicit rest symbols to simulate an anacrusis do not exhibit this issue, as the tick grid is explicitly populated from tick = 0.

Expected Behavior

Expected Behavior

  • Visual: The first eighth note should render with an isolated beam/flag (upbeat of beat 1), and the second and third eighth notes should be beamed together on beat 2.
  • Audio / Metronome: The metronome grid should account for the implicit rest/offset at the start of the measure so that Beat 1 clicks on the implicit silence (tick 0), allowing the 3 eighth notes to play on their correct rhythmic subdivisions before entering measure 2.

Steps To Reproduce

Steps to Reproduce

  1. Load a Guitar Pro file (.gp, .gpx, or .gp5) or MusicXML containing a native incomplete first bar — specifically, a 2/4 score with a 3-eighth-note pickup measure.
  2. Render the score using the default SVG engine.
  3. Observe the first bar: the first eighth note is visually joined by a beam to the second eighth note instead of standing alone.
  4. Enable the metronome / count-in and start playback (api.play()).
  5. Listen to the click track: Beat 1's strong click fires concurrently with the first pickup note rather than aligned with the measure's theoretical downbeat.

Link to jsFiddle, CodePen, Project

No response

Version and Environment

**Environment Info**
alphaTab Version: 1.8.0 (I think)
Build / Binding: @coderline/alphatab (npm package / TypeScript / Browser)
Framework: React / Vite
Browser: Google Chrome (latest)
OS: Windows 11

But if you load the same .gp on https://www.alphatab.net/, the same problem occurs

Platform

Web

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Fields

Priority

None yet

Effort

None yet

Area

None yet

Platform

None yet

Work State

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions