diff --git a/docs/fensalir-rendering-rebuild-migration.md b/docs/fensalir-rendering-rebuild-migration.md index 9529780..a111309 100644 --- a/docs/fensalir-rendering-rebuild-migration.md +++ b/docs/fensalir-rendering-rebuild-migration.md @@ -427,7 +427,11 @@ Let Fensalir fuse Mimir observations into field claims: Acceptance: - one synthetic multi-camera marker creates a stable world-space claim; -- one synthetic audio source creates a localizable confidence field; +- implemented synthetic audio source proof: Mimir lowers an SRP/PHAT-style + source candidate with calibration/source identity and a world-space confidence + envelope, and Fensalir plans it as a `DebugOverlay` FieldEvidence packet; +- next remaining acceptance item: one synthetic multi-camera marker creates a + stable world-space claim; - claims can be inspected by source observation and calibration id. ### Phase 6: Program Output Receipts diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 50a392c..0a46b50 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -270,7 +270,10 @@ a named invariant that the native runtime cannot protect yet. and Fensalir selects audio-path `Phase` and `Confidence` claims as `DebugOverlay` backend packets. `--perfect-machine-profile-smoke` now proves the acoustic constraint is planned through FieldEvidence instead of deferred - through a parallel acoustic packet. + through a parallel acoustic packet. The same smoke now also proves the first + Phase 5 synthetic audio-source candidate: an SRP/PHAT-style localization + result is lowered with calibration/source identity and a world-space + confidence envelope, then planned as a FieldEvidence `DebugOverlay` packet. - Fensalir now owns the first in-process D3D12 field resource resolver cut: shared structured/curve buffer resources import/alias GPU-resident handles, and Fensalir-owned resources allocate GPU slots only when Fensalir is the diff --git a/notes/current-system-map.md b/notes/current-system-map.md index c9088a3..4e0d29e 100644 --- a/notes/current-system-map.md +++ b/notes/current-system-map.md @@ -462,7 +462,12 @@ calibration constraints. Fensalir now selects audio-path `Phase` and `Confidence` claims as `DebugOverlay` backend packets, so calibration timing/path evidence can be inspected through the same FieldEvidence authority while true acoustic source candidates and confidence volumes remain later -fusion work. +fusion work. The first synthetic acoustic source candidate proof now exists: +Mimir lowers an SRP/PHAT-style localized source with calibration/source +identity and a world-space confidence envelope, and Fensalir plans it as a +FieldEvidence `DebugOverlay` packet. Live room geometry must still come from an +explicit measured coordinate frame, not inferred from the recent two-distance +monitor notes. The current teardown/migration map is `docs/fensalir-rendering-rebuild-migration.md`, paired with Fensalir's diff --git a/src/Mimir.BufferSmoke/Program.cs b/src/Mimir.BufferSmoke/Program.cs index a82cc34..eccff97 100644 --- a/src/Mimir.BufferSmoke/Program.cs +++ b/src/Mimir.BufferSmoke/Program.cs @@ -2176,6 +2176,22 @@ static int RunPerfectMachineProfileSmoke() [ new MimirPairDelayObservation("mic-left", "mic-right", 0.0, 0.95) ]); + var acousticSourceFrame = lowerer.BuildAcousticSourceCandidateFrame( + localization is null + ? [] + : + [ + new MimirAcousticSourceFieldCandidate( + "synthetic-speaker", + "synthetic-tdoa-calibration", + "synthetic-audio-source", + "mimir-srp-phat-grid", + localization.PositionMeters, + MimirAcousticLocalizationConfigurations.SrpPhatGrid.TargetPositionUncertaintyMeters, + localization.Score, + 1_000_000_000L) + ]); + var acousticSourcePlan = AquariumFieldLoweringPlanner.Plan(acousticSourceFrame); var authority = new MimirAuthorityPolicyEvaluator().Evaluate(new MimirAuthorityEvaluationInput( "raven-scarlett-witness", new HashSet(["known-node", "matching-codebook", "clock-fit-confidence", "response-profile"], StringComparer.Ordinal), @@ -2201,7 +2217,7 @@ static int RunPerfectMachineProfileSmoke() Console.WriteLine( $"perfect-machine-fensalir cameraResources={cameraFieldFrame.Resources.Count} cameraClaims={cameraFieldFrame.Claims.Count} cameraPlanned={cameraPlan.Packets.Count} cameraDeferred={cameraPlan.DeferredRequests.Count} acousticClaims={acousticFieldEvidence.Claims.Count} acousticPlanned={acousticPlan.Packets.Count} acousticDeferred={acousticPlan.DeferredRequests.Count}"); Console.WriteLine( - $"perfect-machine-localization candidates={localizationGrid.Count} best=({localization?.PositionMeters.X ?? float.NaN:0.000},{localization?.PositionMeters.Y ?? float.NaN:0.000},{localization?.PositionMeters.Z ?? float.NaN:0.000}) score={localization?.Score ?? 0.0:0.000}"); + $"perfect-machine-localization candidates={localizationGrid.Count} best=({localization?.PositionMeters.X ?? float.NaN:0.000},{localization?.PositionMeters.Y ?? float.NaN:0.000},{localization?.PositionMeters.Z ?? float.NaN:0.000}) score={localization?.Score ?? 0.0:0.000} sourceClaims={acousticSourceFrame.Claims.Count} sourcePlanned={acousticSourcePlan.Packets.Count} sourceDeferred={acousticSourcePlan.DeferredRequests.Count}"); Console.WriteLine( $"perfect-machine-authority appliesTo=raven-scarlett-witness decision={authority.Decision} rule={authority.RuleId}"); Console.WriteLine( @@ -2236,6 +2252,11 @@ static int RunPerfectMachineProfileSmoke() acousticFieldEvidence.Claims.Count == 1 && acousticPlan.Packets.Count == 1 && acousticPlan.DeferredRequests.Count == 0 && + acousticSourceFrame.Claims.Count == 1 && + acousticSourcePlan.Packets.Count == 1 && + acousticSourcePlan.DeferredRequests.Count == 0 && + acousticSourceFrame.Claims[0].ClaimKey.Contains("synthetic-tdoa-calibration", StringComparison.Ordinal) && + acousticSourceFrame.Claims[0].ClaimKey.Contains("synthetic-audio-source", StringComparison.Ordinal) && localization is { Score: > 0.90 } && authority.Decision == MimirAuthorityDecision.TrustedEvidence && transport.Transport?.Id == MimirNetworkTransportConfigurations.CultMeshTimingState.Id && diff --git a/src/Mimir.Runtime/Synchronization/MimirFensalirBridgeContracts.cs b/src/Mimir.Runtime/Synchronization/MimirFensalirBridgeContracts.cs index 758830d..7002b39 100644 --- a/src/Mimir.Runtime/Synchronization/MimirFensalirBridgeContracts.cs +++ b/src/Mimir.Runtime/Synchronization/MimirFensalirBridgeContracts.cs @@ -140,6 +140,16 @@ public sealed record MimirCalibrationConstraint( string UsableBandMask, double Confidence); +public sealed record MimirAcousticSourceFieldCandidate( + string CandidateKey, + string CalibrationId, + string SourceId, + string ProducerKey, + System.Numerics.Vector3 PositionMeters, + double RadiusMeters, + double Confidence, + long ObservedTimeNs); + public readonly record struct MimirSurfaceAxes( string X, string Y, diff --git a/src/Mimir.Runtime/Synchronization/MimirFensalirFieldLowering.cs b/src/Mimir.Runtime/Synchronization/MimirFensalirFieldLowering.cs index ce85097..62a54a0 100644 --- a/src/Mimir.Runtime/Synchronization/MimirFensalirFieldLowering.cs +++ b/src/Mimir.Runtime/Synchronization/MimirFensalirFieldLowering.cs @@ -114,6 +114,39 @@ public sealed class MimirFensalirFieldLowering(MimirFensalirLoweringOptions? opt return BuildFieldEvidenceFrame(windows, observations, [], intents); } + public AquariumFieldEvidenceFrame BuildAcousticSourceCandidateFrame( + IEnumerable sourceCandidates) + { + var domains = new List(); + var claims = new List(); + var candidates = new List(); + var seenDomains = new HashSet(StringComparer.Ordinal); + + foreach (var sourceCandidate in sourceCandidates) + { + if (string.IsNullOrWhiteSpace(sourceCandidate.CandidateKey)) + { + continue; + } + + var domain = DomainForAcousticSourceCandidate(sourceCandidate); + AddDomain(domains, seenDomains, domain); + + var claim = ClaimForAcousticSourceCandidate(sourceCandidate, domain.DomainKey); + claims.Add(claim); + candidates.Add(CandidateForClaim(claim, AquariumFieldGuide.Valid(claim.Confidence))); + } + + return new AquariumFieldEvidenceFrame + { + Domains = domains, + Claims = claims, + Candidates = candidates, + AccumulationWindowSeconds = (float)options.AccumulationWindowSeconds, + PresentationDelaySeconds = (float)options.PresentationDelaySeconds + }; + } + private static void AddDomain( ICollection domains, ISet seenDomains, @@ -254,6 +287,23 @@ public sealed class MimirFensalirFieldLowering(MimirFensalirLoweringOptions? opt Vector3.Zero, "Mimir.Runtime"); + private static AquariumFieldDomain DomainForAcousticSourceCandidate(MimirAcousticSourceFieldCandidate candidate) + { + var radius = Math.Max(0.01f, (float)candidate.RadiusMeters); + var center = candidate.PositionMeters; + var boundsRadius = new Vector3(radius); + return new AquariumFieldDomain( + DomainKeyForAcousticSourceCandidate(candidate), + "", + AquariumFieldDomainKind.AudioPath, + Matrix4x4.Identity, + Matrix4x4.Identity, + center - boundsRadius, + center + boundsRadius, + Vector3.Zero, + "Mimir.Runtime"); + } + private static AquariumFieldDomain DomainForSurfaceIntent(MimirSurfaceIntent intent) => new( DomainKeyForSurfaceIntent(intent.IntentKey), @@ -312,6 +362,31 @@ public sealed class MimirFensalirFieldLowering(MimirFensalirLoweringOptions? opt Confidence: confidence); } + private AquariumFieldClaim ClaimForAcousticSourceCandidate( + MimirAcousticSourceFieldCandidate sourceCandidate, + string domainKey) + { + var confidence = Clamp01((float)sourceCandidate.Confidence); + var proposal = new AquariumFieldProposalPolicy( + AquariumFieldProposalKind.CalibrationConstraint, + SourcePdf: 1.0f, + TargetContribution: confidence, + RepresentedCandidateCount: 1, + Seed: StableSeed(sourceCandidate.CandidateKey)); + + return new AquariumFieldClaim( + ClaimKey: $"acoustic-source:{sourceCandidate.CalibrationId}:{sourceCandidate.SourceId}:{sourceCandidate.CandidateKey}", + DomainKey: domainKey, + ProducerKey: sourceCandidate.ProducerKey, + Layer: AquariumFieldLayer.Form, + Encoding: AquariumFieldEncoding.Confidence, + Support: SupportForAcousticSourceCandidate(sourceCandidate), + Proposal: proposal, + PayloadHandle: sourceCandidate.CalibrationId, + ObservedTimeNs: sourceCandidate.ObservedTimeNs, + Confidence: confidence); + } + private AquariumFieldClaim ClaimForSurfaceIntent( MimirSurfaceIntent intent, string domainKey, @@ -427,6 +502,19 @@ public sealed class MimirFensalirFieldLowering(MimirFensalirLoweringOptions? opt TemporalUncertainty: uncertaintySeconds); } + private AquariumFieldSupport SupportForAcousticSourceCandidate(MimirAcousticSourceFieldCandidate sourceCandidate) + { + var radius = Math.Max(options.DefaultSupportRadius, (float)sourceCandidate.RadiusMeters); + return new AquariumFieldSupport( + Center: sourceCandidate.PositionMeters, + Radius: new Vector3(radius), + LocalFrame: Matrix4x4.Identity, + ConservativeRadius: radius, + ProjectedError: radius, + Curvature: 0.0f, + TemporalUncertainty: 0.0f); + } + private AquariumFieldSupport SupportForSurfaceIntent(MimirSurfaceIntent intent) { var age = Math.Max(0.0f, (float)intent.SupportPolicy.MaximumAgeSeconds); @@ -590,6 +678,9 @@ public sealed class MimirFensalirFieldLowering(MimirFensalirLoweringOptions? opt private static string DomainKeyForCalibrationConstraint(string constraintKey) => $"mimir:calibration:{constraintKey}"; + private static string DomainKeyForAcousticSourceCandidate(MimirAcousticSourceFieldCandidate candidate) => + $"mimir:acoustic-source:{candidate.CalibrationId}:{candidate.SourceId}:{candidate.CandidateKey}"; + private static string DomainKeyForSurfaceIntent(string intentKey) => $"mimir:intent:{intentKey}"; private static float Clamp01(float value) => Math.Clamp(value, 0.0f, 1.0f); diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 9a8db2a..52bb47d 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -205,3 +205,4 @@ {"ts": "2026-05-28T08:14:31+01:00", "type": "observation", "status": "ok", "note": "Physical mapping for monitor-routed complex-contour proof: asio-ch0/Input 1 is the shotgun, about 1.5 m from right monitor and 3.0 m from left; asio-ch1/Input 2 is the cardioid, about 0.5 m from left monitor and 1.5 m from right. Geometry should be used when interpreting 20260528-080727 path delays."} {"ts": "2026-05-28T08:20:48+01:00", "type": "verification", "status": "blocked", "note": "ASIO monitor split proof 20260528-081813 added --play-output-channel and captured output 0/output 1 separately. Loopback channels confirmed distinct ASIO output buffers, but physical mic delays were nearly identical across outputs (shotgun delta about 20.885 us; cardioid delta about 24.789 us), inconsistent with declared left/right monitor geometry. Downstream monitor routing/isolation must be verified before learning left/right acoustic paths."} {"ts": "2026-05-28T12:06:53+01:00", "type": "implementation", "status": "ok", "note": "Fensalir now selects FieldEvidence AudioPath Phase/Confidence claims as DebugOverlay backend packets, so Mimir acoustic calibration constraints are planned rather than deferred. Mimir profile smoke now reports acousticPlanned=1 acousticDeferred=0; acoustic source volumes remain Phase 5 fusion work."} +{"ts": "2026-05-28T12:10:23+01:00", "type": "implementation", "status": "ok", "note": "Phase 5 synthetic audio-source proof added: Mimir lowers an SRP/PHAT-style localized source candidate with calibration/source identity and a world-space confidence envelope; Fensalir plans it as a FieldEvidence DebugOverlay packet. Live room geometry still needs an explicit coordinate frame before physical candidates become runtime truth."} diff --git a/state/map.yaml b/state/map.yaml index 2a38b5f..0fa9b31 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -498,7 +498,12 @@ accepted_design: calibration constraints. Fensalir now selects AudioPath Phase/Confidence claims as DebugOverlay backend packets, so acoustic calibration evidence is planned and inspectable through the FieldEvidence authority. Acoustic source - candidates and confidence volumes remain Phase 5 fusion work. + candidates and confidence volumes remain Phase 5 fusion work. The first + synthetic acoustic source candidate proof now lowers an SRP/PHAT-style + localization result with calibration/source identity and a world-space + confidence envelope, and Fensalir plans it as a FieldEvidence DebugOverlay + packet. Live room geometry still needs an explicit measured coordinate + frame before those candidates become runtime truth. - `config/perfect-machine.example.json` declares live owners, sensors, reservoir views, and runtime policy. - `src/Mimir.Runtime/Synchronization` now includes the Perfect Machine module