gp7: read <Program> from GeneralMidi/MidiConnection (AT fallback path)#48
Merged
kaizenman merged 1 commit intogp67-supportfrom Apr 22, 2026
Merged
Conversation
Reading every remaining AT method line-by-line found one more gap. alphaTab's _parseGeneralMidi reads <Program> into track.playbackInfo.program. _parseSound later overwrites that with the first sound's program when <Sounds> is present. PyGuitarPro only read the program from <Sounds> — for a file that has GeneralMidi <Program> but no <Sounds> block (minimal / GP6-era exports), the program was lost. - Reader (src/guitarpro/gp7.py): added <Program> fallback in the GeneralMidi / MidiConnection / MIDISettings loop. When <Sounds> is also present, _read_track's later "mirror first sound onto channel" still wins — same precedence as alphaTab. pytest tests/ — 1609 passed, 0 skipped.
kaizenman
pushed a commit
that referenced
this pull request
Apr 22, 2026
…lback gp7: read <Program> from GeneralMidi/MidiConnection (AT fallback path)
kaizenman
added a commit
that referenced
this pull request
Apr 22, 2026
* Fix GP3 writeOldChord/readOldChord asymmetry writeOldChord unconditionally wrote 6 fret ints after firstFret, but readOldChord only reads them when firstFret != 0 (matching the Guitar Pro byte layout). When a chord with firstFret == 0 was written and then read back, 24 unread bytes remained in the stream, misaligning every following read. The typical symptom was a later note's bend type byte being read as -1, raising "ValueError: -1 is not a valid BendType". Fix: only write the fret list when firstFret is non-zero. Added tests/Chord Old Format.gp3 (derived from Chords.gp3 with the first chord's newFormat set to False and firstFret set to 0). Without the fix the new test fails with the exact error above; with the fix it passes. --------- Co-authored-by: kaizenman <kaizenman@users.noreply.github.com> Co-authored-by: Sviatoslav Abakumov <dust.harvesting@gmail.com>
kaizenman
added a commit
that referenced
this pull request
Apr 22, 2026
…lback gp7: read <Program> from GeneralMidi/MidiConnection (AT fallback path)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Block-by-block walk found one more alphaTab-parity gap.
alphaTab `_parseGeneralMidi` reads `` into `track.playbackInfo.program`. `_parseSound` later overwrites with the first sound's program when `` is present.
PyGuitarPro only read the program from ``. For a file that has `GeneralMidi` / `MidiConnection` `` but no `` block (minimal or GP6-era exports), the program was silently lost.
Fix. Added `` fallback inside the `GeneralMidi` / `MidiConnection` / `MIDISettings` loop in `_read_track`. When `` is also present, PGP's later "mirror first sound onto channel" still wins — same precedence as alphaTab.
pytest tests/ — 1609 passed, 0 skipped.