fix(kls): match real Dexed ScaleLevel/ScaleCurve — sign, exp scale, breakpoint#14
Merged
Conversation
…reakpoint M2DX scaleKeyboardLevel and the dx7ref/dx7refmki C twins diverged from real Dexed dx7note.cc on three parity-invisible, shared Swift+C counts; the circular scaleLevelMatchesDEXED test (M2DX vs the equally-wrong twin) hid them. Port Dexed ScaleLevel/ScaleCurve verbatim into all three: - sign: -curves (0/1) now attenuate, +curves (2/3) boost (was inverted, KLS ran backwards) - exp: exp_scale_data[33]*depth*329>>15 (was kNlsTable*depth+1024>>11, ~8-15x too weak) - breakpoint: note - break_pt - 17 (was +21; whole curve was shifted +4 semitones) - linear: drop the +2048 rounding term; no internal 127 cap (clamp at the outlevel sum) Tests: add scaleKeyboardLevelMatchesRealDexedGoldens (hardcoded real-Dexed values, breaks the circular reference); re-baseline klsAtBreakPoint to the +17 hinge (note 56). MarkICalibrationTests.darkerSustain -> withKnownIssue: the correct KLS drops BASS 1's over-bright Modern centroid 685->180 Hz so the x0.6 'Mark I markedly darker' threshold no longer holds (the disputed di8 darkness is markI-ops-dac finding 2). 240 tests pass (1 known issue). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
scaleKeyboardLevel(DX7 Keyboard Level Scaling) and itsdx7ref/dx7refmkiC reference twins were byte-identical to each other but all three diverged from real Dexed/MSFAdx7note.ccon three parity-invisible, shared Swift+C counts.ReferenceTests.scaleLevelMatchesDEXEDcompared M2DX against the (equally-wrong) hand-ported C twin, so it stayed green while hiding the bugs — the same circular-reference trap flagged for the detune and pitch-EG dimensions in the DX7 fidelity audit.Verified verbatim against
asb2m10/dexedSource/msfa/dx7note.cc(ScaleLevel,ScaleCurve,exp_scale_data, and theDx7Note::initoutlevel composition).Fixes (all shared Swift+C — ported verbatim into the Swift engine + both C twins)
isNegative ? capped : -capped→ Dexedif (curve<2) scale = -scale(−curves attenuate, +curves boost)kNlsTable·depth+1024 >> 11(max ~16) →exp_scale_data[33]·depth·329 >> 15(reaches 127)breakPoint + 21→note − breakPoint − 17+2048rounding + internalmin(127)capTests
scaleKeyboardLevelMatchesRealDexedGoldens— hardcoded real-Dexed golden values spanning left/right, linear/exp, both signs, the hinge, depth 0, and an uncapped >127 case. Breaks the circular M2DX-vs-twin reference.klsAtBreakPointto the+17hinge (note 56).MarkICalibrationTests.darkerSustain→withKnownIssue. The corrected KLS removes ROM1A BASS 1's over-bright modulator scaling (Modern sustain centroid 685 → 180 Hz, toward the Dexed-faithful value — a likely contributor to the long-standing "≈2× brighter than Dexed" reports). That drop means the÷0.6"Mark I markedly darker than Modern" threshold no longer holds; documented as a known issue to revisit together with the Mark I÷8modulation-darkness calibration (a separately-flagged fidelity finding).swift test: 240 tests pass (1 known issue).Audit
Completes the
keyboard-scalingdimension of the DX7 fidelity audit (docs/dx7-fidelity-audit-2026-06-30.md, app repo).🤖 Generated with Claude Code