Skip to content

GP import: chord names/diagrams missing entirely when source file has no Diagram Collection #1056

Description

@carochacs

Repro

Reported against So Far Away (J).gp (GP7/8 tab, likely a community transcription): no chord names or diagrams show anywhere in the highway UI, despite chords clearly being played.

Root cause

Chord name/fingering extraction (_parse_chord_diagrams, lib/gp2rs_gpx.py:719-777 for GP6/7/8; the analogous beat.effect.chord path in lib/gp2rs.py:596-643,1048-1063 for GP3-5) only pulls from the source file's own Diagram Collection — the chord library a person manually builds/names inside Guitar Pro's UI (Properties/Property[@name="DiagramCollection"] for the .gp container). It's applied only on an exact fret-pattern match:

# lib/gp2rs_gpx.py:2025-2033
if fkey not in chord_template_map:
    chord_template_map[fkey] = len(chord_templates)
    _diag = chord_diagram_map.get(fkey)
    chord_templates.append(ChordTemplate(
        name=(_diag['name'] if _diag else ''),
        frets=list(frets_t),
        fingers=(list(_diag['fingers']) if _diag else [-1] * width),
    ))

There's no shape-recognition fallback. This is intentional/documented behavior from the introducing PR (#522 — "Only enriches on exact fret-pattern match; diagram-less charts import identically (blank)", covered by tests/test_gp2rs_gpx.py:1071-1078), but it means any GP file whose author never used GP's separate chord-naming tool imports every chord with a blank name — very common for tab-site transcriptions, which just place notes on the fretboard.

The blank name isn't just a missing label — it hides the entire diagram, name and fret-dots both:

  • plugins/highway_3d/screen.js:13862-13867 — the corner chord-diagram HUD box is fully gated on chordTemplateLabel(tmpl) being non-empty:
    const lbl = chordTemplateLabel(tmpl);
    if (lbl && tmpl?.frets) {
        newChord = { name: lbl, frets: tmpl.frets, t: ch.t, t0: ch.t, chDt, nStr };
    }
    tmpl.frets is populated correctly (the real fret pattern actually played) even when name is blank, but the falsy lbl check throws the whole box away.
  • plugins/highway_3d/screen.js:12852-12853 — the on-neck gold chord-name label above the strummed shape is similarly gated on chordName truthiness (the wireframe box around the shape itself is not gated and still draws).

What's NOT broken

lib/song.py, the WS wire serializer (chord_template_to_wire, lib/song.py:331-357), and lib/routers/ws_highway.py:724-725 all faithfully carry the blank name through — no data loss/corruption downstream of extraction. The gap is entirely at import time (no fallback) and at the diagram-box render gate (blank name hides fret-dots that are otherwise available).

Existing workaround

The editor plugin (plugins/editor/routes.py:3952-3973) round-trips chordName/displayName/per-string fingers on save, so a user can manually add chord names in the editor's authoring UI after import — not automatic, but available today.

Suggested fix

  1. Stop gating the diagram box on lbl truthiness in plugins/highway_3d/screen.js:13862-13867 — show the fret-shape even when unnamed, so users at least see the diagram.
  2. Consider a basic standard-chord shape-recognition fallback (keyed by fret pattern + tuning) for common open/barre chords, so files without an authored Diagram Collection still get sensible names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions