From 72655a063b9f4b331a0cfa4d79d05e82bf09a79f Mon Sep 17 00:00:00 2001 From: byrongamatos Date: Tue, 7 Jul 2026 23:18:54 +0200 Subject: [PATCH] docs(gp2rs): clarify velocity-default comment, mark dead-path fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The mapped-GP velocity comment conflated GP's authoring default (95, Velocities.default) with the drumtab render default (100, DEFAULT_VELOCITY in lib/drums.py) used when `v` is omitted. Clarify both defaults and that only the latter applies to omitted hits. - Mark the `else: times.sort()` fallback in the unmapped-percussion time/velocity sort as belt-and-suspenders — times and velocities are always appended together under the same len<100 guard, so lengths can't actually diverge. No behavior change; comment-only maintainability nits from PR review. Co-Authored-By: Claude Opus 4.8 (1M context) --- lib/gp2rs.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/gp2rs.py b/lib/gp2rs.py index 8e011f0..dcbbd59 100644 --- a/lib/gp2rs.py +++ b/lib/gp2rs.py @@ -1911,10 +1911,13 @@ def convert_drum_track_to_drumtab( hit: dict = {"t": round(t, 3), "p": piece} - # Velocity: GP stores 1-127 MIDI velocity directly; default - # is 95 (Velocities.default). Pass through verbatim, - # clamping defensively so a corrupt file can't poison the - # wire format. + # Velocity: GP stores 1-127 MIDI velocity directly. Note + # this is GP's *authoring* default (95, Velocities.default) + # — unrelated to the drumtab render default of 100 + # (DEFAULT_VELOCITY, lib/drums.py:179), which only applies + # when `v` is omitted from a hit. Pass the GP value through + # verbatim, clamping defensively so a corrupt file can't + # poison the wire format. vel = int(getattr(note, "velocity", 0) or 0) if 1 <= vel <= 127: hit["v"] = vel @@ -1965,6 +1968,10 @@ def convert_drum_track_to_drumtab( _rec["times"] = [p[0] for p in _pairs] _rec["velocities"] = [p[1] for p in _pairs] else: + # Belt-and-suspenders: times & velocities are always appended + # together under the same `len(times) < 100` guard above, so + # in practice the lengths can't diverge. Kept as a defensive + # fallback, not a real divergence case. _rec["times"].sort() return {