Declare alignment streaming DSP program

This commit is contained in:
Meta Vens 2026-05-27 18:55:27 +01:00
commit 67767a79e4
5 changed files with 64 additions and 8 deletions

View file

@ -146,8 +146,11 @@ a named invariant that the native runtime cannot protect yet.
`MIMIR_SYNC_TELEMETRY_SECONDS`. UI and telemetry read cached reports/states;
they do not run synchronization analysis. The same cadence now publishes the
latest actuator command frame for telemetry/readout and queues it into
`AquariumAudioDocument` as an audio control frame; Faust/native DSP still
owns actual sample movement.
`AquariumAudioDocument` as an audio control frame. Mimir also declares the
`faust/mimir_alignment_actuator.dsp` program as an
`AquariumStreamingDspProgram`, so Fensalir has both the persistent Faust DSP
graph and the matching controls. Device I/O/stem routing is still the next
cut before live samples are actually aligned.
- `MimirRuntime` no longer submits the legacy direct `AquariumSplineFrame`
spectrum dashboard. Live spectrum visualization authority is the
`AquariumFieldEvidenceFrame`: Mimir declares the rolling resource, emits a

View file

@ -307,9 +307,11 @@ into nonnegative holdback commands, keeps source-to-`sourceN` slots stable,
reports overflow beyond the six-source profile, and exposes the reference
holdback separately. `MimirRuntime` updates that command frame on the sync
analysis cadence, queues it into `AquariumAudioDocument` as an engine audio
control frame, and telemetry can print the current DSP targets. This is
control-plane publication only; Faust/native DSP still has to be wired as the
hot sample mover.
control frame, declares `faust/mimir_alignment_actuator.dsp` as an
`AquariumStreamingDspProgram`, and telemetry can print the current DSP targets.
Fensalir can now compile/host that persistent Faust graph, but device I/O and
stem routing still have to feed live blocks through it before audio is actually
aligned.
## Visual Fusion

View file

@ -74,6 +74,7 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
private IReadOnlyList<MimirAudioSpectrumSnapshot> lastAudioSpectra = [];
private long spectrumHistorySequence;
private long audioActuatorFrameSequence;
private bool audioActuatorProgramQueued;
private readonly Queue<MimirSpectrumHistoryFrame> spectrumHistory = new();
private AquariumRuntimeServices runtimeServices = AquariumRuntimeServices.Empty;
private MimirActuatorFrame lastAudioActuatorFrame = MimirActuatorFrame.Empty;
@ -667,6 +668,7 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
sceneReady = true;
StartConfiguredSources();
QueueAudioActuatorProgram();
nextAudioSyncSeconds = runtimeSeconds + audioSyncUpdateIntervalSeconds;
nextSpectrumSeconds = runtimeSeconds;
Console.WriteLine($"Mimir Fensalir scene ready at {runtimeSeconds:0.000}s; runtime audio tests and spectra enabled.");
@ -915,6 +917,7 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
return;
}
QueueAudioActuatorProgram();
audio.EnqueueControlFrame(new AquariumAudioControlFrame(
MimirAlignmentActuatorProfile.SixSourceFaust.Id,
frame.ReferenceSourceId,
@ -931,6 +934,29 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
++audioActuatorFrameSequence));
}
private void QueueAudioActuatorProgram()
{
if (audioActuatorProgramQueued)
{
return;
}
var profile = MimirAlignmentActuatorProfile.SixSourceFaust;
var path = ResolveRuntimeAssetPath(profile.FaustDspPath);
if (path == null)
{
Console.WriteLine($"Mimir audio actuator DSP not queued; `{profile.FaustDspPath}` was not found.");
return;
}
audio.EnqueueStreamingDspProgram(new AquariumStreamingDspProgram(
profile.Id,
"mimir_alignment_actuator",
File.ReadAllText(path),
unchecked((int)File.GetLastWriteTimeUtc(path).Ticks)));
audioActuatorProgramQueued = true;
}
private void UpdateAudioSpectra()
{
if (runtimeSeconds < nextSpectrumSeconds)
@ -1040,6 +1066,28 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
: 0.0f;
}
private static string? ResolveRuntimeAssetPath(string relativePath)
{
if (File.Exists(relativePath))
{
return Path.GetFullPath(relativePath);
}
var current = AppContext.BaseDirectory;
while (!string.IsNullOrWhiteSpace(current))
{
var candidate = Path.Combine(current, relativePath);
if (File.Exists(candidate))
{
return candidate;
}
current = Directory.GetParent(current)?.FullName;
}
return null;
}
private static float ParseAudioSyncIntervalSeconds()
{
return float.TryParse(Environment.GetEnvironmentVariable("MIMIR_AUDIO_SYNC_INTERVAL_SECONDS"), out var seconds)

View file

@ -185,3 +185,4 @@
{"ts": "2026-05-27T17:53:38+01:00", "type": "decision", "status": "ok", "note": "Synchronized camera Texture2D resources are not a mandate to invent production visual fusion now. Camera image claims remain debug-view-only until the renderer and audio work are fixed; future camera fusion/feature-extraction lowerings need a separate selected policy decision."}
{"ts": "2026-05-27T18:03:11+01:00", "type": "decision", "status": "ok", "note": "Runtime audio sync states now derive explicit actuator command frames through MimirAlignmentActuatorBank: measured delay remains analyzer truth, the bank converts offsets into nonnegative Faust holdback controls with stable source slots, reference holdback, and overflow reporting. This is control-plane publication only; Faust/native DSP still owns live sample movement."}
{"ts": "2026-05-27T18:06:41+01:00", "type": "decision", "status": "ok", "note": "MimirRuntime now queues the latest MimirAlignmentActuatorBank frame into AquariumAudioDocument as an engine audio control frame. This creates the Mimir-to-Fensalir control contract for Faust/native DSP targets, but remains control-plane only until a streaming DSP sample mover consumes it."}
{"ts": "2026-05-27T18:54:28+01:00", "type": "decision", "status": "ok", "note": "Mimir now declares faust/mimir_alignment_actuator.dsp as an AquariumStreamingDspProgram before queuing actuator controls, giving Fensalir both the persistent Faust DSP graph and the control frames. Live sample alignment still waits on the next device I/O/stem-routing cut."}

View file

@ -183,9 +183,11 @@ accepted_design:
`MimirAlignmentActuatorBank` now converts runtime sync states into explicit
nonnegative Faust holdback commands with stable source slots, a separate
reference holdback, and overflow reporting, then queues those commands into
`AquariumAudioDocument` as engine audio control frames; this publishes DSP
control targets but does not move live samples until the Faust/native hot
path is wired. The synthetic
`AquariumAudioDocument` as engine audio control frames. Mimir also queues
`faust/mimir_alignment_actuator.dsp` as an `AquariumStreamingDspProgram`
so Fensalir can compile/host the persistent Faust graph that consumes those
controls; live sample movement still waits on device I/O and stem routing
through that graph. The synthetic
codebook proof is `dotnet run --project
.\src\Mimir.BufferSmoke\Mimir.BufferSmoke.csproj -- --bioacoustic-self-test`.
`Mimir.BufferSmoke --render-chirp-bin-f32` plus