Repository navigation
feat(eg-bias): selectable boost mode restoring the Core 1.23.0 behaviour (M2DX #168) - #23
Conversation
…our (M2DX #168) 1.24.0 made EG bias follow the DX7 (M2DX #163). A player who confirmed the DX7 match still prefers the old response for breath sounds: raising every operator, modulators included, made breath add harmonics, which the DX7 semantics cannot do (EG bias never lifts above the programmed level). EGBiasMode (.dx7 default, .boost) with setEGBiasMode(_:), slot field egBiasMode and controller NRPN index 40. Boost restores the #97 path: range × controller summed into OL points (cap 99), applied to all six operators through scaleOutputLevel and the 127 ceiling. Preset load resets the mode to .dx7 with the other controller mappings. Boost output is bit-identical to Core 1.23.0 (Modern and Mark I, ranges 15 and 99, breath swell up and down). EGBiasBoostModeTests: exact OL delta, 127 ceiling, DX7 default, boost ignores AMS while DX7 leaves AMS 0 alone, scales with breath and range, switching back restores DX7. 361 tests / 64 suites pass in Debug and Release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
_RefactorEvalDump.swift is a local, uncommitted experiment harness that the previous commit picked up. The file stays on disk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 107a850107
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if egBiasOL > 0 { | ||
| let biasedOL = min(99, outputLevel + Int(egBiasOL)) | ||
| let base = min(127, scaleOutputLevel(outputLevel) + klsOffset) | ||
| let boosted = min(127, scaleOutputLevel(biasedOL) + klsOffset) | ||
| levelIn = levelIn &+ (Int32((boosted - base) << 5) << 16) |
There was a problem hiding this comment.
Stop boosting operators after their envelopes become idle
When one operator finishes its release before the other operators in the voice, env.getsample() returns 0 for that inactive operator, but this unconditional addition gives it a nonzero gain again. Because the voice remains active while any other operator envelope is running, the completed carrier or modulator can continue sounding for the rest of the longest release; apply the boost only when wasActive is true.
Useful? React with 👍 / 👎.
| let base = min(127, scaleOutputLevel(outputLevel) + klsOffset) | ||
| let boosted = min(127, scaleOutputLevel(biasedOL) + klsOffset) | ||
| levelIn = levelIn &+ (Int32((boosted - base) << 5) << 16) |
There was a problem hiding this comment.
Include the output floor when calculating the boost delta
For notes with sufficiently negative keyboard scaling or velocity attenuation, the real envelope output is clamped by max(0, ...), but base and boosted are calculated before that lower clamp and omit velocityOffset. For example, when both scaled levels remain below zero, the actual output-level delta should be zero while this code applies the full raw delta, making an otherwise floor-clamped operator audible. Compute both endpoints through the same complete output-level clamp used by combinedOutputLevel.
Useful? React with 👍 / 👎.
| @Test("Dump envelope baseline to /tmp/refactor-eval/dump.bin") | ||
| func dump() throws { |
There was a problem hiding this comment.
Remove the temporary dump test from the committed suite
This test is explicitly described as an uncommitted experiment, yet swift test now executes it and writes to the fixed path /tmp/refactor-eval/dump.bin without validating any behavior. That adds an unrelated filesystem side effect to every full test run and can fail in restricted or concurrently running test environments; keep this harness outside the test target or remove its @Test entry.
Useful? React with 👍 / 👎.
Summary
For hakaru/M2DX#168. 1.24.0 made EG bias follow the DX7 (#22). The reporter confirmed the DX7 match but prefers the old response for breath sounds: raising all six operators made breath add harmonics (VL70m-like), which the DX7 semantics cannot do.
EGBiasMode—.dx7(default, unchanged 1.24.0 behaviour) /.boost(#97 behaviour).setEGBiasMode(_:), slot fieldegBiasMode, controller NRPN index 40 (AUv3 address 940)..dx7with the other controller mappings.Verification
EGBiasBoostModeTests(exact OL delta, 127 ceiling, DX7 default, boost vs DX7 on an AMS 0 operator, scaling, switching back). ExistingEGBiasTestsunchanged and passing.RT: one
Int32per slot and per voice, no allocation; DX7 mode passesegBiasOL = 0.🤖 Generated with Claude Code