Repository navigation
Fix bugs found while testing: chip numbers, meter band, silence, Drop D 5, translations, theme colour - #4
Merged
Merged
Conversation
useTuner.ts held constants, pure pitch helpers, the state machine, the session log and the Vue refs in 629 lines. Now: - src/tuner/pitch.ts: centsBetween, isHarmonicOf, median, foldTowardTarget. - src/tuner/instruments.ts: the per-instrument settings. - src/tuner/engine.ts: createTunerEngine, the state machine with no Vue and no audio APIs: process(frame, now), selectString, setTuning, reset, and the values the UI shows in `display`. - src/tuner/sessionLog.ts: the "paste to Copilot" session log, now only in development builds; production no longer prints it on every stop. - useTuner.ts: feeds the engine, mirrors it into the same read-only refs, steers the low-pass filter and stops 2 s after "all in tune". Its API is unchanged, so GuitarTuner.vue is untouched. The overtone-fold path no longer repeats the direct path: both go through acceptPitch. The three ways it differed (it shows the folded frame's pitch, drops a continuity jump silently, and does not restart the stability timer when far off) are kept as options of FOLDED_OVERTONE, so behaviour is the same. useTuner.equivalence.test.ts proves it: the old useTuner (verbatim copy in src/test/legacyUseTuner.ts) and the new one get the same random frames, string choices, tuning changes and restarts at the same fake time, 8 sessions of 6000 steps, and everything the UI sees is equal after every step. Changing showFramePitch or resetStabilityWhenOff makes it fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The old useTuner copy and the test comparing it with the new engine served the previous commit; check that commit out to run them again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
public/icons.svg is the Vite template's sprite of social icons (Bluesky, Discord, GitHub, X...); src/assets/hero.svg and src/assets/icon.svg are older copies of the splash and the icon. None is referenced by the app, index.html or the manifest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Now that they live in src/tuner/pitch.ts they can be imported on their own: cents arithmetic and rounding, which multiples count as harmonics, the median against an octave-error spike, and when folding a harmonic down applies and when it leaves the pitch alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/styles/*.css were global stylesheets imported one by one in main.ts. Each is now a <style scoped> block in its component; src/style.css stays global (theme tokens, page background, resets) and is imported first. Scoping also fixes the phone-landscape layout. GuitarTuner's landscape rules shrink the ring to 140 px, the note to 2.75rem and align the chips left, but TunerRing.css and StringChips.css were imported after GuitarTuner.css with selectors just as specific, so they won and the ring stayed at 190 px. Now the parent's rules win as intended; the two rules on TunerRing's inner note use :deep(). Checked in the browser by recording position, size and 26 style properties of every element in 10 states (phone portrait and landscape, desktop; dark and light; tuning selector and settings open): identical before and after except phone landscape, where only the chips, the ring and the note changed, as above. The listening state (in-tune colours, Stop button, locked chip) was checked with an oscillator as microphone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ESLint with the configuration create-vue generates: eslint-plugin-vue's recommended rules, typescript-eslint's recommended rules through @vue/eslint-config-typescript, and @vue/eslint-config-prettier so that formatting stays Prettier's job. The code already passes it. - npm run lint - .github/workflows/ci.yml: lint, tests and the type-checked build on every pull request (until now only pushes to master ran anything). - deploy.yml: lints too, before the tests and the build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mockup/ holds design files and exports made locally; they are not part of the app and should never be committed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 5-string bass preset 'bass_dropd5' was B0 E1 A1 D2 G2, the same as 'bass_std5', so choosing it changed nothing. It is now Standard 5 with the E string dropped a whole tone: B0 D1 A1 D2 G2. The duplicate-preset test becomes a normal test. It found one more pair, 'Tenor Low G' = 'Low G (GCEA)', which is right (a tenor ukulele with a low G is tuned like that) and stays as a named alias, so users who chose it keep their choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Below its noise gate useAudioCapture sends no frames at all, so the engine's 500 ms latch-and-fade never ran in true silence: "Hold steady", the frequency and a half-full ring stayed on screen while nothing played. useTuner now blanks them 500 ms (SIGNAL_HOLD_MS) after the last frame, through a new engine.clearDisplay() that writes the same values the latch-and-fade writes and keeps the needle where it was. The analysis is untouched: the engine never reads its display values, and its timers, history and decisions are left as they were. The virtual-guitar silence test becomes a normal test; two useTuner tests cover the timing (still shown at 450 ms, blank at 550 ms) and the reading coming back with the next frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- String chips were numbered backwards: shown thinnest first, the high E
said "6" and the low E "1", while the line under the ring (and guitar
convention) calls the low E string 6. Now 1 to 6 from the thinnest.
- The green band of the cents meter showed ±5 cents but the tuner accepts
±8, so the needle could sit outside the band while "in tune". The band is
now drawn from the engine's ACCEPT_CENTS (exported for it).
- The tuning list said "6str" in every language; it now uses the
translated suffix like the top bar ("6 corde").
- <html lang> stayed "en" whatever the language; it now follows it.
- theme-color (browser bar, installed app) was always dark; it now takes
the --bg-base of the theme in use.
Component tests mount StringChips, CentsMeter and TuningSelector with
@vue/test-utils in happy-dom. vitest.config.ts points the icon package at
its ES build, because its "main" is CommonJS in a "type": "module"
package, which Node refuses (Vite's browser build already reads
"module").
Checked in the browser too: chips, band at 42-58%, "6 corde", lang it/zh,
theme-color #050508 / #f5f0ff.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Built on #3 (and on master after #1 and #2): merge #3 first and this diff shrinks to the five commits below. The tuning analysis is not changed: no thresholds, timers, windows, filters or confirmation rules.
Fixes
ACCEPT_CENTSengine.clearDisplay(), display only)<html lang>entheme-color--bg-baseAlso:
mockup/is in.gitignore(design files stay local).The silence fix only touches what is shown: the engine never reads its
displayvalues, and its stability timer, history and decisions are left as they were.Tests
223 tests, no expected failures left: the two
it.failsfrom #2 are normal tests now. The duplicate-preset check found one more pair, "Tenor Low G" = "Low G (GCEA)", which is correct (a tenor ukulele with a low G) and is listed as a named alias so nobody loses that choice. New component tests (@vue/test-utils+ happy-dom) for the chips, the meter band and the translated suffix, plus<html lang>; twouseTunertests for the silence timing.vitest.config.tspoints@lineiconshq/free-iconsat its ES build for the tests, since itsmainis CommonJS inside a"type": "module"package.Checked in the browser as well (an oscillator as the microphone for the silence): chips
1 E4 … 6 E2, band at 42–58 %, "6 corde",langit → zh,theme-color#050508 / #f5f0ff, reading blank 1.2 s after the sound stops while still listening.Not changed (analysis)
lockedStringIndex).🤖 Generated with Claude Code