Skip to content

feat(adaptation): scale-root tonic + opt-in hand-shift compensation - #1886

Merged
glloq merged 1 commit into
mainfrom
claude/general-midi-boop-audit-j8u0ks
Aug 3, 2026
Merged

feat(adaptation): scale-root tonic + opt-in hand-shift compensation#1886
glloq merged 1 commit into
mainfrom
claude/general-midi-boop-audit-j8u0ks

Conversation

@glloq

@glloq glloq commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Two capability-adaptation features the audit flagged as "declared but never consumed at playback".

  1. Scale root (tonic) for octave_mode computePlayableNotes hardcoded root=C, so a diatonic/pentatonic instrument tuned to any other key materialized the wrong in-scale notes. Adds a scale_root pitch class (0..11) to instruments_latency and instrument_voices (migration 032, default 0=C), threads it through the settings/voice commands, the DB read/write whitelists, and a "Tonalité/Key" selector in the Notes tab that re-materializes the playable set live. The scale is now built off the chosen tonic; chromatic ignores it. Playback already honors the materialized selected_notes, so no scheduler change was needed here.

  2. Hand-shift travel-time compensation (opt-in, default OFF) The hand-position planner emits move_too_fast warnings when an actuator can't reach the next fret/position in time, and LatencyCompensator had shiftExtraMs/compensateTimestamp to act on them — but nothing wired them in. The scheduler now retains the loaded file's warnings and, when playback.handShiftCompensation is enabled, dispatches a flagged note-on early by the shortfall (requiredMs - availableMs) so the hand arrives on time; the lookahead window is widened to match. Default off because the early note deliberately desyncs from other instruments and the right value is hardware-specific. Drum channel and non-note events are never affected.

Tests: scale-root DB round-trip (settings + voices), computePlayableNotes root offset (frontend), hand-shift gating/shortfall/reset. Backend 1334 green; typecheck, prettier, eslint (0 errors) clean; migration 032 applies.

Claude-Session: https://claude.ai/code/session_01AoexTLbJhezUpFHKKq85BP

Two capability-adaptation features the audit flagged as "declared but never
consumed at playback".

1. Scale root (tonic) for octave_mode
   computePlayableNotes hardcoded root=C, so a diatonic/pentatonic instrument
   tuned to any other key materialized the wrong in-scale notes. Adds a
   `scale_root` pitch class (0..11) to instruments_latency and instrument_voices
   (migration 032, default 0=C), threads it through the settings/voice commands,
   the DB read/write whitelists, and a "Tonalité/Key" selector in the Notes tab
   that re-materializes the playable set live. The scale is now built off the
   chosen tonic; chromatic ignores it. Playback already honors the materialized
   selected_notes, so no scheduler change was needed here.

2. Hand-shift travel-time compensation (opt-in, default OFF)
   The hand-position planner emits `move_too_fast` warnings when an actuator
   can't reach the next fret/position in time, and LatencyCompensator had
   shiftExtraMs/compensateTimestamp to act on them — but nothing wired them in.
   The scheduler now retains the loaded file's warnings and, when
   `playback.handShiftCompensation` is enabled, dispatches a flagged note-on
   early by the shortfall (requiredMs - availableMs) so the hand arrives on
   time; the lookahead window is widened to match. Default off because the
   early note deliberately desyncs from other instruments and the right value
   is hardware-specific. Drum channel and non-note events are never affected.

Tests: scale-root DB round-trip (settings + voices), computePlayableNotes root
offset (frontend), hand-shift gating/shortfall/reset. Backend 1334 green;
typecheck, prettier, eslint (0 errors) clean; migration 032 applies.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AoexTLbJhezUpFHKKq85BP
@glloq
glloq merged commit 45ad684 into main Aug 3, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants