Prove dialogue cleaner follows aligned stems

This commit is contained in:
Meta Vens 2026-06-01 04:55:13 +01:00
commit 35e1f090c9
7 changed files with 118 additions and 7 deletions

View file

@ -166,7 +166,10 @@ subtraction, and slow downward expansion. `MimirRuntime` now queues that Faust
program as `dual-mic-dialogue-cleaner` with `host_voice` and residual `ambient`
output stems, but only feeds it from the alignment actuator's published
`aligned_source_*` stem frame. Alignment is therefore a structural precursor to
cleanup, not an optional sidecar. Treat the C# bridge as an audition/scoring
cleanup, not an optional sidecar. The routing invariant is covered by
`Mimir.BufferSmoke --dialogue-cleaner-routing-smoke`: alignment frames queue the
cleaner DSP and cleaner input block, while cleaner output frames are the
publishable `NativeProgram` stems. Treat the C# bridge as an audition/scoring
receipt, not the final native live DSP path.
The synthetic invariant is
`dotnet run --project .\src\Mimir.BufferSmoke\Mimir.BufferSmoke.csproj -- --bioacoustic-self-test`;

View file

@ -824,7 +824,10 @@ a named invariant that the native runtime cannot protect yet.
`faust/mimir_dual_mic_dialogue_cleaner.dsp`; Mimir queues it as
`dual-mic-dialogue-cleaner`, consuming the alignment actuator's published
`aligned_source_*` stem frame rather than raw mic buffers, and emitting
`host_voice` plus a rejected residual witness. Treat the C# bridge as the
`host_voice` plus a rejected residual witness. The routing smoke is
`--dialogue-cleaner-routing-smoke`: it verifies post-alignment stems queue
the cleaner program/block and that program publication belongs to the
cleaner output, not the raw alignment lanes. Treat the C# bridge as the
contract and offline scorer for the
native/Faust implementation, not as a parallel live mixer authority. The
next matching probe loop also exists as

View file

@ -335,8 +335,11 @@ witness subtraction, and slow downward expansion. `MimirRuntime` queues it as
`dual-mic-dialogue-cleaner` with `host_voice` and residual `ambient` output
stems. It is fed from the alignment actuator's published `aligned_source_*`
stem frame, not from raw mic buffers, so Faust alignment is a real structural
precursor to cleanup. This is the first hot-lane cleaner socket, not proof that
the final studio denoiser is solved.
precursor to cleanup. `Mimir.BufferSmoke --dialogue-cleaner-routing-smoke`
proves the boundary: alignment frames queue the cleaner DSP and input block, and
cleaner output frames are what enter `NativeProgram` stem publication. This is
the first hot-lane cleaner socket, not proof that the final studio denoiser is
solved.
`MimirTargetedBioacousticProbePlanner` is the matching "ask the room a better
question" owner. It consumes per-source spectral residuals and optional source
pathology notes, then emits gain-bounded shaped probe bands for the

View file

@ -167,6 +167,11 @@ if (args.Any(arg => string.Equals(arg, "--audio-stem-publication-smoke", StringC
return RunAudioStemPublicationSmoke();
}
if (args.Any(arg => string.Equals(arg, "--dialogue-cleaner-routing-smoke", StringComparison.OrdinalIgnoreCase)))
{
return RunDialogueCleanerRoutingSmoke();
}
if (args.Any(arg => string.Equals(arg, "--obs-stem-shared-memory-smoke", StringComparison.OrdinalIgnoreCase)))
{
return RunObsStemSharedMemorySmoke();
@ -4144,6 +4149,51 @@ static int RunAudioStemPublicationSmoke()
: 1;
}
static int RunDialogueCleanerRoutingSmoke()
{
var stemBus = new SmokeAudioStemBus();
using var runtime = new MimirRuntime(
new AquariumRuntimeOptions(Headless: true, CultCachePath: null),
new MimirSynchronizationSettings());
runtime.AttachServices(new AquariumRuntimeServices(SmokeFieldResourceBroker.Instance, stemBus));
runtime.OnSceneReady();
runtime.Audio.DrainStreamingDspPrograms();
stemBus.Publish(new AquariumAudioStemFrame(
MimirAlignmentActuatorProfile.SixSourceFaust.Id,
[
new AquariumAudioStemChannel(0, "aligned_source_0", "Aligned source 0", "asio-ch0-shotgun", [0.10f, 0.20f, 0.10f, 0.00f]),
new AquariumAudioStemChannel(1, "aligned_source_1", "Aligned source 1", "asio-ch1-cardioid", [0.08f, 0.18f, 0.09f, 0.01f])
],
FrameCount: 4,
SampleRate: 48_000,
Sequence: 12));
runtime.Update(0.016f, new InputState());
var programs = runtime.Audio.DrainStreamingDspPrograms();
var blocks = runtime.Audio.DrainStreamingAudioBlocks();
var cleanerProgram = programs.FirstOrDefault(program => string.Equals(program.ProfileId, MimirDialogueCleanerProfile.DualMicFaust.Id, StringComparison.Ordinal));
var cleanerBlock = blocks.FirstOrDefault(block => string.Equals(block.ProfileId, MimirDialogueCleanerProfile.DualMicFaust.Id, StringComparison.Ordinal));
Console.WriteLine(
$"dialogue-cleaner-routing-smoke programs={programs.Count} blocks={blocks.Count} " +
$"cleanerProgram={(cleanerProgram is null ? "missing" : cleanerProgram.FaustName)} " +
$"cleanerBlockChannels={cleanerBlock?.Channels.Count ?? 0} frameCount={cleanerBlock?.FrameCount ?? 0} " +
$"sources={string.Join(",", cleanerBlock?.Channels.Select(channel => channel.SourceId) ?? [])}");
return cleanerProgram is not null &&
cleanerBlock is not null &&
cleanerBlock.Channels.Count == MimirDialogueCleanerProfile.DualMicFaust.SourceCount &&
cleanerBlock.Channels[0].ChannelIndex == 0 &&
cleanerBlock.Channels[1].ChannelIndex == 1 &&
string.Equals(cleanerBlock.Channels[0].SourceId, "asio-ch0-shotgun", StringComparison.Ordinal) &&
string.Equals(cleanerBlock.Channels[1].SourceId, "asio-ch1-cardioid", StringComparison.Ordinal) &&
cleanerBlock.FrameCount == 4 &&
cleanerBlock.SampleRate == 48_000
? 0
: 1;
}
static int RunObsStemSharedMemorySmoke()
{
if (!OperatingSystem.IsWindows())
@ -9892,3 +9942,44 @@ sealed class FakeTextureLeaseVideoDriver : IMimirVideoCaptureDriver, IMimirFensa
{
}
}
sealed class SmokeAudioStemBus : IAquariumAudioStemBus
{
private readonly Queue<AquariumAudioStemFrame> frames = new();
private readonly Dictionary<string, AquariumAudioStemFrame> latest = new(StringComparer.Ordinal);
public void Publish(AquariumAudioStemFrame frame)
{
frames.Enqueue(frame);
latest[frame.ProfileId] = frame;
}
public IReadOnlyList<AquariumAudioStemFrame> DrainPublishedFrames(int maxFrames = 64)
{
var drained = new List<AquariumAudioStemFrame>();
while (drained.Count < maxFrames && frames.TryDequeue(out var frame))
{
drained.Add(frame);
}
return drained;
}
public AquariumAudioStemFrame? LatestFrame(string profileId) =>
latest.TryGetValue(profileId, out var frame) ? frame : null;
}
sealed class SmokeFieldResourceBroker : IAquariumFieldResourceBroker
{
public static SmokeFieldResourceBroker Instance { get; } = new();
private SmokeFieldResourceBroker()
{
}
public AquariumFieldResourceLease LeaseTexture2D(AquariumTexture2DLeaseRequest request) => AquariumFieldResourceLease.Invalid;
public bool CommitLeaseVersion(string resourceKey, ulong version, ulong producerFenceValue) => false;
public bool UploadTexture2D(AquariumTexture2DUpload upload) => false;
}

View file

@ -45,7 +45,7 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
private readonly MimirPresentationControlState presentationControls = new();
private readonly MimirSceneEditorState sceneEditor = new();
private readonly MimirProgramSurfaceConfigDocument programSurfaceConfig;
private readonly MimirObsStemPublicationState obsStemPublication = new(MimirObsPublicationConfigurations.AlignmentActuatorStemBus);
private readonly MimirObsStemPublicationState obsStemPublication = new(MimirObsPublicationConfigurations.NativeProgram);
private readonly MimirObsStemSharedMemoryPublisher? obsStemPublisher;
private readonly IReadOnlyList<MimirStreamSourceFactory> sourceFactories;
private readonly AquariumUiDocument ui;
@ -1483,6 +1483,8 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
return;
}
QueueDialogueCleanerProgram();
var candidates = alignedFrame.Channels
.OrderBy(channel => DialogueCleanerSourceRank(channel.SourceId))
.ThenBy(channel => channel.SourceId, StringComparer.Ordinal)
@ -1567,6 +1569,11 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
if (string.Equals(stemFrame.ProfileId, MimirAlignmentActuatorProfile.SixSourceFaust.Id, StringComparison.Ordinal))
{
QueueStreamingDialogueCleanerAudioBlock(stemFrame);
continue;
}
if (string.Equals(stemFrame.ProfileId, MimirDialogueCleanerProfile.DualMicFaust.Id, StringComparison.Ordinal))
{
obsStemPublication.Consume(stemFrame);
consumed = true;
}

View file

@ -321,3 +321,4 @@
{"ts": "2026-06-01T04:32:13+01:00", "type": "verification", "status": "ok", "note": "Tightened Kiyo dual-mic composite bridge after listening feedback: limited measured-band gain to 1.18x, raised incoherent-band suppression, and enabled residual envelope expansion. Reprocessed the 20260601-042314 raw ASIO/Kiyo receipt. Cleaner MP4 now at artifacts/runtime/kiyo-dual-mic-composite/kiyo-dual-mic-composite-latest.mp4; ffprobe verified 10.000 s 640x480@30 video plus 9.994 s 48 kHz mono AAC. Composite RMS fell from 0.046805 to 0.034400 while preserving the same -141.019 sample mic-delay estimate."}
{"ts": "2026-06-01T04:44:10+01:00", "type": "decision", "status": "ok", "note": "Moved dual-mic cleanup authority toward Faust after listening feedback showed the C# residual expander made the Kiyo composite choppier rather than cleaner. Disabled the expander in --asio-dual-mic-composite-wav defaults, added faust/mimir_dual_mic_dialogue_cleaner.dsp as a smooth two-input shotgun/cardioid dialogue cleaner, and queued it from MimirRuntime as dual-mic-dialogue-cleaner with host_voice plus residual ambient stems. Verified dotnet build and Faust 2.85.5 C++ generation for the DSP."}
{"ts": "2026-06-01T04:46:01+01:00", "type": "decision", "status": "ok", "note": "Corrected the Faust cleaner wiring after user caught the prerequisite: dual-mic cleanup must consume post-alignment audio. The runtime no longer queues dual-mic-dialogue-cleaner from raw rolling buffers in parallel with the actuator. It now waits for the alignment actuator's published aligned_source_* stem frame from Fensalir's audio stem bus, then queues that aligned pair into the cleaner profile on the next tick. Alignment is a structural precursor to cleanup."}
{"ts": "2026-06-01T04:54:24+01:00", "type": "verification", "status": "ok", "note": "Added and verified --dialogue-cleaner-routing-smoke. The smoke publishes a synthetic post-alignment aligned_source_* stem frame into MimirRuntime's Fensalir audio stem bus, then verifies Mimir queues the dual-mic-dialogue-cleaner Faust program and a two-channel cleaner StreamingAudioBlock sourced from asio-ch0-shotgun and asio-ch1-cardioid. Runtime publication now treats alignment frames as the cleaner input boundary and cleaner frames as NativeProgram stem publication, so host_voice is the publishable program stem rather than raw aligned_source lanes."}

View file

@ -665,8 +665,11 @@ accepted_design:
shotgun/cardioid dialogue cleaner and Mimir queues it as
`dual-mic-dialogue-cleaner`, fed from the alignment actuator's published
`aligned_source_*` stem frame rather than raw mic buffers, emitting
`host_voice` plus a rejected residual witness. The C# path is a contract,
scorer, and offline diagnostic, not a competing live mixer.
`host_voice` plus a rejected residual witness. `Mimir.BufferSmoke
--dialogue-cleaner-routing-smoke` verifies that aligned stem frames queue
the cleaner program/block and that cleaner output, not raw alignment lanes,
feeds `NativeProgram` stem publication. The C# path is a contract, scorer,
and offline diagnostic, not a competing live mixer.
`MimirTargetedBioacousticProbePlanner` is now the residual-driven probe
planner for improving that calibration instead of blindly EQing harder. It
consumes per-source spectral residuals plus optional source pathology notes