Skip to content

fix: score against the chart's effective tuning and capo - #86

Open
JohanStolk wants to merge 1 commit into
got-feedBack:mainfrom
JohanStolk:fix/use-effective-tuning
Open

JohanStolk wants to merge 1 commit into
got-feedBack:mainfrom
JohanStolk:fix/use-effective-tuning

Conversation

@JohanStolk

@JohanStolk JohanStolk commented Oct 17, 2026 •

Copy link
Copy Markdown

_syncChartStateFromHw() took the tuning and capo from getSongInfo(). The host keeps getSongInfo() as the original song metadata (feedBack#952: "getSongInfo() retains original metadata; effective metadata is available through … getTuning(), getCapo()"), while getNotes() / getChords() return the chart after any chart-transform provider ran.

So when a transform re-frets the chart and changes the tuning to match, note detection combined transformed frets with the original tuning and expected the wrong pitch. Example: a Drop D part re-fretted as D-standard shapes (low string unchanged, the other five strings +2 frets, tuning reported as [-2,-2,-2,-2,-2,-2]). Scored against the original [-2,0,0,0,0,0], every note on strings 2–6 is expected 2 semitones high, far outside the pitch tolerance, so correctly played notes would be scored as misses.

Change: prefer the highway's effective getTuning() / getCapo(), falling back to songInfo on older hosts (no getters), or when the getter returns nothing usable (empty array, throws). The string-count fallbacks use the same tuning. Without a transform the effective values equal the original ones, so nothing changes for normal play.

Tests (test/chart_state_sync.test.js, 3 new):

  • the effective tuning and capo win over the song info;
  • older hosts without the getters keep using the song info;
  • an empty or throwing getter falls back to the song info.

npm test: 356 pass, 0 fail. Also verified end to end in the FeedBack web app with a chart-transform provider that re-frets a Drop D chart: note detection's chart state reports the transformed [-2,-2,-2,-2,-2,-2].

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Chart state now reflects the highway’s effective tuning and capo when available, keeping displayed string counts consistent with the resolved tuning.
    • When effective tuning or capo values are unavailable, unusable, or cannot be retrieved, chart state falls back to the song’s metadata.

_syncChartStateFromHw() took the tuning and capo from getSongInfo(),
which the host keeps as the ORIGINAL metadata. A chart-transform
provider (core #952) can re-fret the chart and change its tuning to
match, e.g. a Drop D part shown as D-standard shapes; scoring those
frets against the original tuning expected the wrong pitch on every
re-fretted string. Prefer the highway's effective getTuning() and
getCapo() (what the highway shows), falling back to songInfo on older
hosts or when they return nothing usable. Without a transform the two
are identical, so nothing changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Johan Stolk <johan.stolk@tutamail.com>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 75ed23d2-452d-4641-a216-375e9310220c
📥 Commits

Reviewing files that changed from the base of the PR and between 412433d and 8a839b4.

📒 Files selected for processing: 2
  • screen.js
  • test/chart_state_sync.test.js

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Chart-state synchronization now prefers usable highway tuning and capo values over song metadata. String-count inference uses the resolved tuning. Tests cover highway overrides, compatibility with hosts that lack the getters, and fallback values.

Changes: Chart state synchronization

Layer / File(s) Summary
Resolve effective tuning and capo
screen.js, test/chart_state_sync.test.js
_syncChartStateFromHw() uses usable highway tuning and capo values when available, with song metadata as a fallback. String-count inference uses the resolved tuning. Tests cover overrides, hosts without the getters, and empty or throwing getter results.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 8a839

Scoring now uses a chart's effective tuning and capo after a transform. Hosts without these values keep the previous behavior. No regression remains that should block merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: scoring now uses the chart's effective tuning and capo.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 too large.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JohanStolk

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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