Repository navigation
Calibrate the reference pitch: A4 from 436 to 445 Hz, as on a pedal tuner - #9
Merged
Merged
Conversation
…uner - A new setting, referencePitch (A4 in whole hertz, 436–445, 440 by default), saved with the theme and the language under accordatore_settings. A saved value out of range, not a whole number or missing falls back to 440. - The active tuning is calibrated to it: every string's frequency is scaled by referencePitch / 440 (calibrateTuning). The reference has its own computed, so only a new pitch gives a new tuning object; a running tuner then starts again from the first string, aimed at the new targets. A new theme or language leaves it alone. - Settings: a "Reference pitch" stepper showing "A4 = 440 Hz", in English, Italian and Chinese. - Design system: UiStepper (− and + around the value, in the segmented control's track; a spin button for the keyboard) and the minus and plus icons. The sheet's focus trap now ignores controls out of the Tab order, so Tab cannot leave the sheet from its last stop.
At A4 = 445 Hz the tuner starts again on the low E, aims the analysis at the calibrated string, reads a string still tuned for 440 Hz as 19.6 cents flat, and confirms the calibrated one.
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.
The tuner always tuned to A4 = 440 Hz. Orchestras, some bands and older recordings use another A, and pedal tuners let you calibrate it: the BOSS TU-3 goes from 436 to 445 Hz in 1 Hz steps. This adds the same setting. The tuning engine is unchanged.
What changed
Setting (
useSettings)referencePitch: A4 in whole hertz, from 436 to 445, 440 by default. It is saved with the theme and the language underaccordatore_settings.setReferencePitchrounds and clamps.Targets (
tunings.ts,useConfig)calibrateTuning(tuning, hz)scales every string's frequency by hz / 440 and keeps the notes. At 440 it returns the preset itself.activeTuningis the chosen tuning calibrated to the setting. The reference has its own computed, so only a new pitch gives a new tuning object. A running tuner then starts again from the first string, aimed at the new targets. A change of theme or language leaves the tuner where it is.Settings sheet
Design system (
src/ui)UiStepper: − and + around the value, in the segmented control's grey track. It is a spin button: the arrow keys step it, Home and End go to the bounds. The buttons stay out of the Tab order and are dimmed at the bounds; a tap hands focus to the value.minusandplus, on the 24 px grid like the others.UiSheet: the focus trap counted controls out of the Tab order (tabindex="-1") as its first and last stops, so Tab could leave the sheet from its real last stop. In Settings that already happened from the chosen language, unless it was 中文.UiStepperrow in the components table.Checked
npm test: 322 tests, up from 287.npm run lintandvue-tsc -bare clean.useTuner.test.ts): at A4 = 445 Hz a running tuner goes back to the low E and aims at the calibrated frequency. It reads a string still tuned for 440 Hz as 19.6 cents flat (tune up), and confirms the calibrated one.For the reviewer