feat(adaptation): scale-root tonic + opt-in hand-shift compensation - #1886
Merged
Conversation
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
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.
Two capability-adaptation features the audit flagged as "declared but never consumed at playback".
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_rootpitch 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.Hand-shift travel-time compensation (opt-in, default OFF) The hand-position planner emits
move_too_fastwarnings 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, whenplayback.handShiftCompensationis 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