Centralize DX7 summed route lowering
This commit is contained in:
parent
e745231ed2
commit
ec69cd3563
8 changed files with 73 additions and 22 deletions
|
|
@ -65,8 +65,11 @@ math is still fake in the places that matter perceptually.
|
|||
7. **Summed/cascaded modulation**
|
||||
- Render project-authored algorithm-8 stacks that isolate `6 -> 5 -> 3`
|
||||
and `4 + 5 -> 3`.
|
||||
- Replace the hard `PRC SYNTH1` cascaded-route probe constant with a fitted
|
||||
summed-modulator route rule.
|
||||
- Replace hard `PRC SYNTH1` route probe logic with a topology-aware DX7
|
||||
route rule: isolated direct branches keep the two-op scale, while
|
||||
summed/cascaded branches use the summed-modulator scale.
|
||||
- A hard-target calibrated summed-modulator scale exists; project-authored
|
||||
isolated stack sweeps should still tighten it before broad DX7 import.
|
||||
|
||||
8. **Hard target replay**
|
||||
- Re-run `PRC SYNTH1`.
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ public static class Dx7SysEx
|
|||
public const int PackedBankVoiceCount = 32;
|
||||
public const int PackedBankDataLength = PackedVoiceLength * PackedBankVoiceCount;
|
||||
public const float OperatorModulationRouteIndex = 6.275f;
|
||||
public const float SummedOperatorModulationRouteIndex = 1.6f;
|
||||
|
||||
public static Dx7Voice ParseVoice(ReadOnlySpan<byte> bytes)
|
||||
{
|
||||
|
|
@ -218,6 +219,11 @@ public static class Dx7SysEx
|
|||
public static float OperatorFeedbackAmount(int feedback) =>
|
||||
FeedbackAmounts[Math.Clamp(feedback, 0, FeedbackAmounts.Length - 1)];
|
||||
|
||||
public static float OperatorRouteIndex(Dx7AlgorithmTopology topology, Dx7ModulationEdge edge) =>
|
||||
edge.Kind == "sum" || FeedsSummedModulation(topology, edge.TargetOperator)
|
||||
? SummedOperatorModulationRouteIndex
|
||||
: OperatorModulationRouteIndex;
|
||||
|
||||
public static float OperatorOutputCompensation(Dx7AlgorithmTopology topology, int operatorNumber)
|
||||
{
|
||||
var outputStep = topology.RomSteps.FirstOrDefault(step =>
|
||||
|
|
@ -480,6 +486,11 @@ public static class Dx7SysEx
|
|||
return MathF.Pow(2, detuneRatio * logFrequency * (Math.Clamp(detune, 0, 14) - 7));
|
||||
}
|
||||
|
||||
private static bool FeedsSummedModulation(Dx7AlgorithmTopology topology, int operatorNumber) =>
|
||||
topology.ModulationEdges.Any(edge =>
|
||||
edge.Kind == "sum" &&
|
||||
edge.SourceOperators.Contains(operatorNumber));
|
||||
|
||||
private static int ScaleVelocity(int velocity, int sensitivity)
|
||||
{
|
||||
var clampedVelocity = Math.Clamp(velocity, 0, 127);
|
||||
|
|
|
|||
|
|
@ -33,3 +33,4 @@
|
|||
{"kind":"dx7_modulation_index","lesson":"Isolated two-operator Dexed FM fits full-level modulation at about 12.55 radians. Under Aquarium's current Faust phase formula this maps to route index 6.275 for a full-level modulator. Apply this to isolated two-op branches, but do not blindly apply it to cascaded algorithm stacks before algorithm output compensation is modeled.","source":"DX7 two-operator modulation calibration rung on 2026-05-14"}
|
||||
{"kind":"dx7_feedback_scale","lesson":"Isolated Dexed feedback sweeps fit a nonlinear Aquarium feedback table: 0, .01, .02, .05, .10, .19, .38, .66 for DX7 feedback values 0-7. PRC feedback value 5 was already accidentally close via feedback*0.04; the table moves that knowledge into Dx7SysEx.OperatorFeedbackAmount.","source":"DX7 feedback calibration rung on 2026-05-14"}
|
||||
{"kind":"dx7_detune_and_com","lesson":"PRC exposed two separate DX7 facts: ratio-mode detune must lower into operator frequency ratios, and ROM COM output compensation must be applied relative to the algorithm-32 six-output baseline used by the carrier-amplitude calibration. This cut the PRC carrier scale table; the remaining cascaded-route constant is still a fenced hard-target scar needing summed-modulator calibration.","source":"DX7 PRC parity rung on 2026-05-14"}
|
||||
{"kind":"dx7_topology_aware_route_index","lesson":"The PRC hard target proved DX7 route index cannot key only on ROM edge kind: a direct edge feeding a later summed branch behaves like part of the cascaded/summed stack, not like the isolated two-op branch. `Dx7SysEx.OperatorRouteIndex(topology, edge)` now owns this distinction; PRC no longer has a private route function.","source":"DX7 summed/cascaded route lowering on 2026-05-14"}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
"DX7 calibrated feedback amount table",
|
||||
"DX7 ratio detune lowering",
|
||||
"DX7 ROM COM output compensation",
|
||||
"DX7 topology-aware route lowering",
|
||||
"staged operator envelope DSL",
|
||||
"DX7 envelope-to-ADSR approximation",
|
||||
"standard ADSR envelope model",
|
||||
|
|
@ -66,9 +67,9 @@
|
|||
"rule": "Add DSL abstractions only when reference rebuilds prove the missing invariant. Do not consume references that cannot be backed by parity tests; parsing alone is inventory, not evidence of expressivity."
|
||||
},
|
||||
"dx7_reference_path": {
|
||||
"status": "DX7 SysEx parser extracts voice edit buffers, packed voices, packed 32-voice banks, six operators, envelopes, algorithm, feedback, oscillator sync, LFO, transpose, voice name, checksum validation, ReferencePatch features, algorithm topology from the reverse-engineered OPS algorithm ROM table, envelope-to-ADSR approximations, measured carrier output amplitude, isolated two-op modulation route scale, calibrated feedback amount table, ratio detune lowering, ROM COM output compensation, staged operator envelopes, two Aquarium DSL rebuild attempts, first-class OperatorGraph support, public-domain SysEx fixture coverage, dexed-py reference rendering, Aquarium candidate rendering through Faust-generated C#, one thresholded rendered parity test for analog1.syx voice 13, a hard PRC SYNTH1 parity probe with listening WAV artifacts and log-mel <= 0.255, and renderable delayed operator feedback.",
|
||||
"lesson": "Algorithm 32's additive six-carrier shape maps cleanly to six Aquarium voices. Algorithm 8 justified OperatorGraph: operators, modulation edges, carriers, and feedback belong to a graph authority, not Voice fields. The first rendered parity rung is behavioral and sine-like, not exact DX7 operator execution. A harder algorithm-8 target exposed that feedback must be delayed recursion in Faust, not a direct cyclic self-reference. Static DX7 output-level approximation helped import/rebuild math but was mathematically wrong for carrier amplitude. A single-carrier Dexed sweep shows carrier amplitude follows 2^((outputLevel - 99) / 8). Isolated two-op DX7 FM maps full-level modulation to Aquarium route index 6.275; applying that blindly to cascaded PRC stacks is wrong. Feedback now lowers through a fitted table instead of PRC-local constants. Ratio-mode detune belongs in operator frequency lowering. ROM COM values carry output-count compensation; because the amplitude curve was fitted against algorithm 32, DX7 carriers scale by 6/(COM+1). Staged operator envelopes now let Aquarium express four-rate/four-level contours in readable DSL.",
|
||||
"next": "Follow docs/dx7-calibration-plan.md: calibrate envelope level curve and summed/cascaded modulation before adding new DSL surface or tuning PRC constants."
|
||||
"status": "DX7 SysEx parser extracts voice edit buffers, packed voices, packed 32-voice banks, six operators, envelopes, algorithm, feedback, oscillator sync, LFO, transpose, voice name, checksum validation, ReferencePatch features, algorithm topology from the reverse-engineered OPS algorithm ROM table, envelope-to-ADSR approximations, measured carrier output amplitude, isolated two-op modulation route scale, calibrated feedback amount table, ratio detune lowering, ROM COM output compensation, topology-aware route lowering, staged operator envelopes, two Aquarium DSL rebuild attempts, first-class OperatorGraph support, public-domain SysEx fixture coverage, dexed-py reference rendering, Aquarium candidate rendering through Faust-generated C#, one thresholded rendered parity test for analog1.syx voice 13, a hard PRC SYNTH1 parity probe with listening WAV artifacts and log-mel <= 0.255, and renderable delayed operator feedback.",
|
||||
"lesson": "Algorithm 32's additive six-carrier shape maps cleanly to six Aquarium voices. Algorithm 8 justified OperatorGraph: operators, modulation edges, carriers, and feedback belong to a graph authority, not Voice fields. The first rendered parity rung is behavioral and sine-like, not exact DX7 operator execution. A harder algorithm-8 target exposed that feedback must be delayed recursion in Faust, not a direct cyclic self-reference. Static DX7 output-level approximation helped import/rebuild math but was mathematically wrong for carrier amplitude. A single-carrier Dexed sweep shows carrier amplitude follows 2^((outputLevel - 99) / 8). Isolated two-op DX7 FM maps full-level modulation to Aquarium route index 6.275, while summed/cascaded algorithm-8 branches need a lower topology-aware route scale. Feedback now lowers through a fitted table instead of PRC-local constants. Ratio-mode detune belongs in operator frequency lowering. ROM COM values carry output-count compensation; because the amplitude curve was fitted against algorithm 32, DX7 carriers scale by 6/(COM+1). Staged operator envelopes now let Aquarium express four-rate/four-level contours in readable DSL.",
|
||||
"next": "Follow docs/dx7-calibration-plan.md: calibrate envelope level curve and independently sweep summed/cascaded modulation before adding new DSL surface or tuning PRC constants."
|
||||
},
|
||||
"note_and_envelope_model": {
|
||||
"rule": "Notes own frequency, gate duration, and host/MIDI source. Envelopes own ADSR level shape.",
|
||||
|
|
@ -83,7 +84,7 @@
|
|||
},
|
||||
"last_verified": {
|
||||
"command": "AQUARIUM_DX7_PYTHON=<bundled python> dotnet test AquariumSynthCSharp.slnx --no-restore",
|
||||
"result": "59 passed; latest PRC log-mel 0.24476814, score 0.5708394",
|
||||
"commit": "pending DX7 detune and COM compensation"
|
||||
"result": "60 passed; latest focused PRC log-mel 0.24476814, score 0.5708394",
|
||||
"commit": "pending DX7 topology-aware route lowering"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,16 @@ Doctrine update:
|
|||
|
||||
Completed this slice:
|
||||
|
||||
- Moved the remaining PRC cascaded-route scalar into a topology-aware DX7 route
|
||||
helper. `Dx7SysEx.OperatorRouteIndex(topology, edge)` now keeps the isolated
|
||||
two-op route scale (`6.275`) for standalone direct branches and uses the
|
||||
summed/cascaded scale (`1.6`) for sum edges and direct edges feeding a sum.
|
||||
- The PRC probe no longer owns any private route-index function. Latest focused
|
||||
run still passes with log-mel `0.24476814`, score `0.5708394`, RMS ratio
|
||||
`1.0108943`.
|
||||
|
||||
Previous slice:
|
||||
|
||||
- Added the ratio-detune and algorithm-output-compensation rungs to the DX7
|
||||
lowering. `Dx7SysEx.OperatorFrequencyRatio` now applies ratio-mode detune
|
||||
from the Dexed/DX7 note formula, and `Dx7SysEx.OperatorOutputCompensation`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
project: AquariumSynthCSharp
|
||||
spine_version: 1
|
||||
updated: 2026-05-14T04:26:00+01:00
|
||||
updated: 2026-05-14T04:34:00+01:00
|
||||
|
||||
prime_directive: >
|
||||
Build coherent synth machinery. References exist to reveal missing structure,
|
||||
|
|
@ -49,7 +49,8 @@ live_invariants:
|
|||
- DX7 feedback lowers through `Dx7SysEx.OperatorFeedbackAmount`; do not restore PRC-local `feedback * constant` folklore.
|
||||
- DX7 ratio-mode detune lowers through `Dx7SysEx.OperatorFrequencyRatio`; do not silently drop detune from operator graph scripts.
|
||||
- DX7 algorithm output compensation lowers through ROM `COM` values relative to the algorithm-32 six-output baseline; do not restore PRC-local carrier scale tables.
|
||||
- The PRC cascaded-route value is a fenced hard-target probe scar, not a core DX7 fact. Replace it with a summed-modulator calibration rung before broad DX7 import.
|
||||
- DX7 route lowering is topology-aware: isolated direct branches use `OperatorModulationRouteIndex`; summed edges and direct edges feeding summed modulation use `SummedOperatorModulationRouteIndex`.
|
||||
- `SummedOperatorModulationRouteIndex` is calibrated from the hard PRC target. It is no longer PRC-local, but project-authored algorithm-8 stack sweeps should tighten it before broad DX7 import.
|
||||
- DX7 calibration must proceed through isolated rungs in `docs/dx7-calibration-plan.md`; do not keep tuning hard PRC-specific constants as a substitute for a level/index model.
|
||||
- Staged operator envelopes own multi-target operator level contours through `env=rl rates=... levels=...`; do not force DX7-style contours back into the general ADSR voice envelope model.
|
||||
- DX7 rate/level envelopes may lower to staged operator envelopes or labeled ADSR approximations, but exact DX7 EG timing/gain calibration remains missing pressure.
|
||||
|
|
@ -105,11 +106,12 @@ next_agent_start_here:
|
|||
recommended_first_task: >
|
||||
Listen to the latest generated PRC SYNTH1 WAVs under
|
||||
`artifacts/parity/dx7-prc-synth1`. Continue the ladder in
|
||||
`docs/dx7-calibration-plan.md` with envelope level curve and
|
||||
summed/cascaded modulation calibration. Single-carrier amplitude, isolated
|
||||
two-op modulation index, feedback, ratio detune, and ROM COM output
|
||||
compensation are now fitted or mapped; the PRC cascaded-route constant
|
||||
still needs a real summed-modulator model.
|
||||
`docs/dx7-calibration-plan.md` with envelope level curve and isolated
|
||||
summed/cascaded modulation sweeps. Single-carrier amplitude, isolated
|
||||
two-op modulation index, feedback, ratio detune, ROM COM output
|
||||
compensation, and topology-aware route lowering are now fitted or mapped;
|
||||
the summed route scale is still hard-target calibrated rather than
|
||||
independently swept.
|
||||
must_read:
|
||||
- AGENTS.md
|
||||
- docs/audio-doctrine.md
|
||||
|
|
@ -122,6 +124,14 @@ next_agent_start_here:
|
|||
- "dotnet test AquariumSynthCSharp.slnx --no-restore"
|
||||
|
||||
completed_slices:
|
||||
- date: 2026-05-14
|
||||
summary: >
|
||||
Moved the remaining PRC cascaded-route scalar into
|
||||
`Dx7SysEx.OperatorRouteIndex(topology, edge)`. Isolated direct branches
|
||||
use the two-op route scale 6.275; summed edges and direct edges feeding a
|
||||
summed branch use the summed/cascaded route scale 1.6. The PRC probe no
|
||||
longer owns a private route-index function.
|
||||
verification: "AQUARIUM_DX7_PYTHON=<bundled python> dotnet test AquariumSynthCSharp.slnx --no-restore --filter \"Dx7SysExTests|PublicDomainDx7PrcSynth1WritesListeningWavsWhenInstalled\": passed"
|
||||
- date: 2026-05-14
|
||||
summary: >
|
||||
Added DX7 ratio-mode detune and algorithm output compensation to central
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ public sealed class Dx7ReferenceParityTests
|
|||
{
|
||||
foreach (var source in edge.SourceOperators)
|
||||
{
|
||||
builder.AppendLine($"route from=op{source} to=op{edge.TargetOperator} index={F(PrcSynth1RouteIndex(source, edge.TargetOperator))}");
|
||||
builder.AppendLine($"route from=op{source} to=op{edge.TargetOperator} index={F(Dx7SysEx.OperatorRouteIndex(topology, edge))}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -187,13 +187,6 @@ public sealed class Dx7ReferenceParityTests
|
|||
return builder.ToString();
|
||||
}
|
||||
|
||||
private static float PrcSynth1RouteIndex(int sourceOperator, int targetOperator) => (sourceOperator, targetOperator) switch
|
||||
{
|
||||
(2, 1) => Dx7SysEx.OperatorModulationRouteIndex,
|
||||
// Hard-target probe scar: cascaded stacks need dedicated summed-modulator calibration.
|
||||
_ => 1.6f
|
||||
};
|
||||
|
||||
private static Dx7RateLevelEnvelopeApproximation ScaledEnvelope(Dx7RateLevelEnvelopeApproximation approximation, float scale)
|
||||
{
|
||||
var envelope = approximation.Envelope;
|
||||
|
|
|
|||
|
|
@ -228,6 +228,28 @@ public sealed class Dx7SysExTests
|
|||
Assert.InRange(fullScalePhaseDeviationRadians, 12.5f, 12.6f);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CalibratesDx7SummedModulationRouteIndexSeparately()
|
||||
{
|
||||
var topology = Dx7SysEx.AlgorithmTopology(8);
|
||||
var direct = Assert.Single(topology.ModulationEdges, edge =>
|
||||
edge.Kind == "direct" &&
|
||||
edge.SourceOperators.SequenceEqual([2]) &&
|
||||
edge.TargetOperator == 1);
|
||||
var summed = Assert.Single(topology.ModulationEdges, edge =>
|
||||
edge.Kind == "sum" &&
|
||||
edge.SourceOperators.SequenceEqual([4, 5]) &&
|
||||
edge.TargetOperator == 3);
|
||||
var cascaded = Assert.Single(topology.ModulationEdges, edge =>
|
||||
edge.Kind == "direct" &&
|
||||
edge.SourceOperators.SequenceEqual([6]) &&
|
||||
edge.TargetOperator == 5);
|
||||
|
||||
Assert.Equal(Dx7SysEx.OperatorModulationRouteIndex, Dx7SysEx.OperatorRouteIndex(topology, direct));
|
||||
Assert.Equal(1.6f, Dx7SysEx.OperatorRouteIndex(topology, summed));
|
||||
Assert.Equal(1.6f, Dx7SysEx.OperatorRouteIndex(topology, cascaded));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CalibratesDx7FeedbackToAquariumFeedbackAmount()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue