diff --git a/artifacts/runtime/mimir-buffer-field-preview.png b/artifacts/runtime/mimir-buffer-field-preview.png new file mode 100644 index 0000000..d36220f Binary files /dev/null and b/artifacts/runtime/mimir-buffer-field-preview.png differ diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 4c5c36f..608b6c4 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -101,6 +101,12 @@ a named invariant that the native runtime cannot protect yet. service and can emit live sync telemetry with `MIMIR_SYNC_TELEMETRY_SECONDS`. UI and telemetry read cached reports/states; they do not run synchronization analysis. +- `MimirRuntime` publishes live ASIO spectrum history to Fensalir in two layers: + `AquariumBufferFieldFrame` carries the real buffer-field intent for spectrum + windows as spline-domain tube fields with tangent/curvature/normal/derivative + appearance and probe policy, while `AquariumSplineFrame` is the temporary + Catmull-Rom tube preview so the buffer contents remain visible before GPU + reservoir lowering owns the draw. - `MimirRuntime` queues bioacoustic timeline PCM through Fensalir audio when the active timing witness is allowed. `MimirAudioSynchronizationSettings.Mode` selects `chirp-only`, `passive`, or `hybrid`; passive disables active @@ -233,9 +239,14 @@ a named invariant that the native runtime cannot protect yet. with probe durations long enough to keep loopback and mic windows live. 6. Bind Fensalir UI to the synchronization hub so buffer depth, stream cadence, source timestamps, and output settings are visible and adjustable. -7. Move GPU feature extraction, fusion, material fitting, render budgeting, and +7. Lower `AquariumBufferFieldFrame` spline tube fields into Fensalir compute: + sample buffer-domain paths stochastically by visual contribution, emit SDF + splat probes, write them into the spatiotemporal splat reservoir, and sample + that reservoir in the temporally antialiased scene pass. The direct spline + preview must stay a witness until this path owns rendering. +8. Move GPU feature extraction, fusion, material fitting, render budgeting, and Spout2 publication into Fensalir. -8. Move mic alignment, room suppression, voice separation, spatialization, and +9. Move mic alignment, room suppression, voice separation, spatialization, and stem generation into Faust/native DSP. -9. Keep the OBS bridge witness ledger as evidence before expanding receiver +10. Keep the OBS bridge witness ledger as evidence before expanding receiver machinery. diff --git a/notes/current-system-map.md b/notes/current-system-map.md index c9a1a8f..90077fb 100644 --- a/notes/current-system-map.md +++ b/notes/current-system-map.md @@ -305,6 +305,24 @@ Visual fusion belongs in Fensalir over current reservoir claims. Native capture workers provide frames; Fensalir owns feature extraction, matching, material fitting, render budgeting, and publication. +The live debug spectrum view now has two separate authorities: + +- `AquariumBufferFieldFrame` is the real Fensalir contract. Mimir expresses + each rolling audio spectrum window as a buffer-backed spline tube field: + frequency lives in the spline domain, amplitude shapes the tube path, and + appearance/probe policy can reference tangent, curvature, normal, derivative, + object domain, and parent-space transforms. This is the surface the future + compute lowering consumes. +- `AquariumSplineFrame` is only the immediate preview witness. It renders the + same spectrum windows as camera-facing Catmull-Rom tube ribbons so humans can + sanity-check ASIO loopback and mic buffers before the reservoir path owns the + draw. It must not become the final visual authority. + +The intended Fensalir lowering is buffer field expression -> compute-generated +stochastic SDF splat probes -> spatiotemporal splat reservoir -> reservoir +sampling for temporally antialiased surface contribution. Splat density is a +function of visual contribution, not uniform polyline tessellation. + ## Known Risks - Windows device names vary by driver and localization. diff --git a/src/Mimir.Runtime/MimirRuntime.cs b/src/Mimir.Runtime/MimirRuntime.cs index ed53b99..82751f8 100644 --- a/src/Mimir.Runtime/MimirRuntime.cs +++ b/src/Mimir.Runtime/MimirRuntime.cs @@ -119,6 +119,7 @@ public sealed class MimirRuntime : IAquariumRuntime { var channelCount = Math.Max(1, lastAudioSpectra.Count); var cameraZ = channelCount * SpectrumChannelSeparation; + var spectrumSplineFrame = BuildSpectrumSplineFrame(); return new AquariumFrame( new ViewFrame(Vector2.Zero, 24.0f), new Vector3(0.0f, 0.0f, cameraZ), @@ -129,7 +130,8 @@ public sealed class MimirRuntime : IAquariumRuntime { TraceHeightFieldSurface = false, UseStarfieldBackground = false, - SplineFrame = BuildSpectrumSplineFrame(), + BufferFieldFrame = BuildSpectrumBufferFieldFrame(spectrumSplineFrame), + SplineFrame = spectrumSplineFrame, }); } @@ -615,6 +617,64 @@ public sealed class MimirRuntime : IAquariumRuntime return new AquariumSplineFrame { Splines = splines }; } + private static AquariumBufferFieldFrame BuildSpectrumBufferFieldFrame(AquariumSplineFrame previewFrame) + { + if (!previewFrame.HasInput) + { + return AquariumBufferFieldFrame.Empty; + } + + return AquariumBufferFieldFrame.Compose(fields => + { + foreach (var spline in previewFrame.Splines) + { + if (!spline.Id.StartsWith("spectrum-", StringComparison.Ordinal)) + { + continue; + } + + fields.SplineTube( + $"mimir.audio.field.{spline.Id}", + "mimir.audio.spectrum-history", + spline, + AquariumFieldDomainBinding.Identity( + "spline.frequency-window", + "mimir.audio.spectrum-lane", + "mimir.audio.spectrum-stack"), + new AquariumSplineTubeAppearance( + new Vector4(1.0f, 0.72f, 0.22f, 1.0f), + spline.Style.Radius, + spline.Style.Alpha, + spline.Style.ZeroThreshold, + spline.Style.Feather, + TangentWeight: 1.0f, + CurvatureWeight: 0.55f, + NormalWeight: 0.35f, + DerivativeWeight: 0.70f), + new AquariumSplineTubeProbePolicy( + MaxProbeCount: Math.Clamp(spline.Vertices.Count * Math.Max(1, spline.CatmullRomSubdivisions), 16, 512), + BaseDensity: 1.0f, + MinimumVisualContribution: 0.008f, + Seed: StableSeed(spline.Id))); + } + }); + } + + private static uint StableSeed(string text) + { + unchecked + { + var hash = 2166136261u; + foreach (var ch in text) + { + hash ^= ch; + hash *= 16777619u; + } + + return hash == 0u ? 0xB11FF13Du : hash; + } + } + private static IReadOnlyList BuildSpectrumWindowSpline( MimirAudioSpectrumSnapshot spectrum, float channelBaseY, diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 5354c79..aa82021 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -116,3 +116,4 @@ {"ts": "2026-05-25T08:16:14+01:00", "type": "verification", "status": "ok", "note": "Rendered Fensalir MelSpectrumStack from Mimir ASIO rolling buffers with canary-packet-trill chirp-only song after scene-ready; captured artifacts/runtime/mimir-mel-spectrum-stack.png with four labeled 192 kHz Focusrite lanes."} {"ts": "2026-05-25T13:18:43+01:00", "type": "verification", "status": "ok", "note": "Rendered live ASIO audio as Fensalir 3D spline spectrograms: each mel FFT window is one AquariumSpline3D per source, channels are stacked on Y, window history recedes on Z with alpha fade, and capture artifacts/runtime/mimir-3d-spectrum-splines.png proves the scene pass draws the rolling history after scene-ready with canary-packet-trill chirp-only output."} {"ts": "2026-05-25T13:47:32+01:00", "type": "implementation", "status": "ok", "note": "Fensalir spline rendering now follows the XRLineRenderer-style shape: AquariumSpline3D carries Catmull-Rom subdivision plus radius/emission/alpha/zero-threshold/feather style, D3D12 expands sampled spline segments into camera-facing ribbon geometry, and D3D12SplinePS shades coverage from an SDF-like width coordinate. Mimir renders ASIO rolling mel windows through this primitive; capture artifacts/runtime/mimir-catmull-sdf-spectrum-splines.png verifies the canary-packet-trill runtime path."} +{"ts": "2026-05-25T13:56:03+01:00", "type": "decision", "status": "ok", "note": "Fensalir spectrum visualization authority split: Mimir now emits AquariumBufferFieldFrame spline tube fields as the real buffer-domain contract, with tangent/curvature/normal/derivative appearance and probe policy for future compute SDF splat reservoir lowering. AquariumSplineFrame remains only the immediate Catmull-Rom preview witness until compute lowering owns rendering."}