Repository navigation
fix(web): a new root carries the speed, so a moved chord sounds in its new key - #35
Merged
Merged
Conversation
…s new key The speed counts the root's swings and the other notes swing at ratios to it, so moving a chord (C major to D major, both 4:5:6) at the same speed played and drew exactly the old chord under new names. A root change from a chip or a link now scales the speed by the step between the roots, clamped to the slider's range; at Real pitch the new root sounds at its own pitch.
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.
Problem
In chord mode, pressing a new root (e.g. C major → D major) changed the labels but not what played. The speed counts the root's swings per second and every other note runs at a ratio to it; both chords are 4 : 5 : 6, so at an unchanged speed they sound (and draw) identically. Verified in the browser: after Real pitch at C4 (262 Hz), pressing D4 left the speed at 262 Hz.
Fix
On any root change (chip press or pasted link, when both the old and new root exist) the speed is multiplied by
midiToHz(new) / midiToHz(old), clamped to 0.25–1000 Hz. A running Real-pitch glide still stops. Applies in single-note mode too.Validation
vitest396/396 (5 new tests: scaling, chord move, clamp at the top, empty pick, pasted link; one existing link test now expects theSetSpeedbeforePlay),svelte-check0 errors,cargo fmt/cargo testpass