Skip to content

Calibrate the reference pitch: A4 from 436 to 445 Hz, as on a pedal tuner - #9

Merged
AndrianLeah merged 2 commits into
masterfrom
claude/cool-booth-c9a710
Dec 1, 2026
Merged

AndrianLeah merged 2 commits into
masterfrom
claude/cool-booth-c9a710

Conversation

@AndrianLeah

Copy link
Copy Markdown
Owner

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 under accordatore_settings.
  • A saved value that is missing (settings saved before this change), out of range or not a whole number loads as 440. setReferencePitch rounds 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.
  • activeTuning is 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

  • A Reference pitch section with a stepper showing "A4 = 440 Hz". Italian: Diapason; Chinese: 基准音高.

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.
  • Icons: minus and plus, on the 24 px grid like the others.
  • Fix in 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 中文.
  • README: a UiStepper row in the components table.

Checked

  • npm test: 322 tests, up from 287. npm run lint and vue-tsc -b are clean.
  • New tests:
    • loading, validating and saving the setting;
    • the calibrated frequencies (A2 = 109.75 Hz at A4 = 439 Hz);
    • a new tuning object only when the reference changes;
    • the stepper, the Settings control and the sheet's Tab wrap.
  • Tuner (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.
  • In the browser (Chromium, desktop and phone width, dark and light): the stepper with the mouse and the keyboard, the dimmed bounds, the focus ring for the keyboard only, and the value written to storage.
  • Not checked: on a real phone, or with a real instrument.

For the reviewer

  • Mockup: the FigCraft file has no stepper and no minus/plus icons yet.
  • Main screen: it does not show the calibration when it is not 440 Hz.

…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.
@AndrianLeah
AndrianLeah merged commit af21c7c into master Dec 1, 2026
1 check passed
@AndrianLeah
AndrianLeah deleted the claude/cool-booth-c9a710 branch December 1, 2026 18:05
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.

1 participant