Skip to content

Gp3To5Importer reads bit 0x02 as Heavy accent in GP3/GP4 — original software does not #1

@kaizenman

Description

@kaizenman

Note: parked in this fork as a reminder. Intent is to file upstream at CoderLine/alphaTab via the "Bug report" issue template (https://github.com/CoderLine/alphaTab/issues/new/choose), not as a plain issue.

Gp3To5Importer.readNoteEffects (packages/alphatab/src/importer/Gp3To5Importer.ts, line 1214) treats note-flags bit 0x02 as AccentuationType.Heavy for all GP3/GP4/GP5 versions:

if ((flags & 0x02) !== 0) {
    newNote.accentuated = AccentuationType.Heavy;
} else if ((flags & 0x40) !== 0) {
    newNote.accentuated = AccentuationType.Normal;
}

This does not match the original Guitar Pro applications. Heavy accents (0x02) only exist in GP5 — they are silently dropped when GP3/GP4 read or write the file.

@Perlence (maintainer of PyGuitarPro) ran an empirical test against Guitar Pro 4.0 and Guitar Pro 5.2 and posted the full read/write matrix here:
Perlence/PyGuitarPro#56 (comment)

Summary:

Format Op Flag Original GP behaviour
GP3 read `0x02` no effect
GP3 read `0x40` accentuated
GP4 read `0x02` no effect
GP4 read `0x40` accentuated
GP5 read `0x02` heavy accentuated
GP5 read `0x40` accentuated

GP3 has no accent support at all; GP4 has only normal (`0x40`); GP5 has both.

Suggested fix: gate the Heavy branch on _versionNumber >= 500:

if (this._versionNumber >= 500 && (flags & 0x02) !== 0) {
    newNote.accentuated = AccentuationType.Heavy;
} else if ((flags & 0x40) !== 0) {
    newNote.accentuated = AccentuationType.Normal;
}

Happy to send a PR if helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions