diff --git a/calibration/bioacoustic/complex-contour-live-20260525-063229.md b/calibration/bioacoustic/complex-contour-live-20260525-063229.md new file mode 100644 index 0000000..96e682c --- /dev/null +++ b/calibration/bioacoustic/complex-contour-live-20260525-063229.md @@ -0,0 +1,40 @@ +# Complex Contour Live Scarlett Receipt 2026-05-25 06:32:29 + +## Setup + +- Renderer: `canary-packet-trill` +- Playback artifact: `artifacts/asio/canary-packet-live-20260525-063229-f32.raw` +- Capture artifact: `artifacts/asio/scarlett-canary-packet-live-20260525-063229-f32.raw` +- ASIO driver: `Focusrite USB ASIO` +- Sample rate: `192000` +- Buffer size: `256` +- Inputs: `Input 1`, `Input 2`, `Loopback 1`, `Loopback 2` +- Outputs: `Output 1`, `Output 2` +- Playback gain: `1.0` +- Captured frames: `765952` +- Nonzero samples: `2211119` + +## Results + +Reference channel is `asio-ch2` / Loopback 1. + +| Candidate | Meaning | Prediction | Estimate | Prediction Error | Confidence | Direct Hits | Cluster MAE | Phase MAE | +| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | +| `asio-ch3` | Loopback 2 | `0.000000` samples | `-0.002628` samples | `-0.014 us` | `0.126` | `216` | `0.008405` samples | `0.001 rad` | +| `asio-ch1` | shotgun/co-streamer mic path | `544.244999` samples | `543.480112` samples | `-3.984 us` | `0.002` | `14` | `3.335599` samples | `0.858 rad` | +| `asio-ch0` | cardioid/local mic path | `781.490952` samples | `781.787929` samples | `+1.547 us` | `0.011` | `23` | `2.949737` samples | `0.382 rad` | + +## Interpretation + +The interface loopback path is sample-locked well below one microsecond. The +complex contour receiver, using the persisted channel model, also survives the +live DAC/speaker/room/mic/ADC path: both physical mics land within four +microseconds of their prior path seeds in this run, and the cardioid is within +about one and a half microseconds. + +This is not a final microsecond sync claim because the physical mic confidence +is still low and the estimates are judged against previous path seeds rather +than an independently measured ground-truth distance. It is, however, the first +fresh meatspace proof that the complex contour/channel-model path can hear the +current witness and return usable direct-path timing instead of only replaying +old artifacts. diff --git a/docs/bioacoustic-timeline-watermark.md b/docs/bioacoustic-timeline-watermark.md index 4f44d55..d9bafa3 100644 --- a/docs/bioacoustic-timeline-watermark.md +++ b/docs/bioacoustic-timeline-watermark.md @@ -207,3 +207,14 @@ rolling buffers directly, and publishes `complex-contour` reports alongside the existing audio sync reports. `--complex-contour-runtime-self-test` proves the surface synthetically at 192 kHz: a `693.5` sample delay is recovered at about `0.219 us` error from runtime-shaped rolling buffers. + +The first fresh live Scarlett run after this wiring is preserved at +`calibration/bioacoustic/complex-contour-live-20260525-063229.md`. It rendered a +new `canary-packet-trill` witness, played it through Focusrite ASIO, recorded +all four 192 kHz inputs, and analyzed the capture with the current complex +contour channel model. Loopback 1 to Loopback 2 measured `-0.014 us`, proving +the interface clock path is effectively sample-locked. Physical mic paths +survived the room: the shotgun path landed `-3.984 us` from its prior seed and +the cardioid landed `+1.547 us`. Confidence is still too low for a final +microsecond sync claim, but this is fresh meatspace evidence through the actual +DAC/speaker/room/mic/ADC path. diff --git a/notes/current-system-map.md b/notes/current-system-map.md index e1f7118..c9a1a8f 100644 --- a/notes/current-system-map.md +++ b/notes/current-system-map.md @@ -282,6 +282,16 @@ extracts Float32 windows from rolling audio buffers to publish with about 0.219 us error from rolling buffers. The next real-world proof is to run that lane through live Scarlett loopback and mics, not only stored ASIO artifacts. +That real-world proof now has a first receipt: +`calibration/bioacoustic/complex-contour-live-20260525-063229.md`. A freshly +rendered canary-packet witness was played through Focusrite ASIO and captured +from all four 192 kHz Scarlett inputs. Loopback 1 to Loopback 2 measured +-0.014 us, the shotgun path landed -3.984 us from its prior path seed, and the +cardioid path landed +1.547 us from its prior path seed with the current +channel model loaded. This proves the contour/channel-model path survives a +fresh DAC/speaker/room/mic/ADC pass, but low physical confidence means the next +cut is stronger direct-path confidence and independently measured path truth, +not a victory lap. The first actuator proof now exists: `faust/mimir_alignment_actuator.dsp` owns six channels of bounded fractional delay/gain controls for Faust/native DSP, and `Mimir.BufferSmoke --bioacoustic-actuator-self-test --sample-rate 48000 diff --git a/src/Mimir.Runtime/Synchronization/MimirRuntimeConfiguration.cs b/src/Mimir.Runtime/Synchronization/MimirRuntimeConfiguration.cs index ccdc113..f7ae5b1 100644 --- a/src/Mimir.Runtime/Synchronization/MimirRuntimeConfiguration.cs +++ b/src/Mimir.Runtime/Synchronization/MimirRuntimeConfiguration.cs @@ -29,7 +29,8 @@ public sealed class MimirRuntimeConfiguration var bufferDuration = model.BufferSeconds > 0.0 ? TimeSpan.FromSeconds(Math.Clamp(model.BufferSeconds, 0.25, 60.0)) : MimirSynchronizationSettings.FromEnvironment().BufferDuration; - var audio = (model.AudioSync?.ToSettings(new MimirAudioSynchronizationSettings()) ?? new MimirAudioSynchronizationSettings()) + var configDirectory = Path.GetDirectoryName(path); + var audio = (model.AudioSync?.ToSettings(new MimirAudioSynchronizationSettings(), configDirectory) ?? new MimirAudioSynchronizationSettings()) .WithEnvironmentOverrides(); var sourceModels = model.Streams @@ -39,7 +40,7 @@ public sealed class MimirRuntimeConfiguration .SelectMany(ToDescriptors) .ToArray(); var sources = sourceModels - .Select(stream => TryCreateSource(stream, Path.GetDirectoryName(path))) + .Select(stream => TryCreateSource(stream, configDirectory)) .Where(source => source != null) .Cast() .ToArray(); @@ -227,7 +228,7 @@ public sealed class MimirAudioSyncConfig public bool EnableComplexContourRuntime { get; set; } - public MimirAudioSynchronizationSettings ToSettings(MimirAudioSynchronizationSettings fallback) + public MimirAudioSynchronizationSettings ToSettings(MimirAudioSynchronizationSettings fallback, string? configDirectory = null) { return new MimirAudioSynchronizationSettings { @@ -243,16 +244,24 @@ public sealed class MimirAudioSyncConfig : fallback.WatermarkGain, CalibrationModelPath = string.IsNullOrWhiteSpace(CalibrationModelPath) ? fallback.CalibrationModelPath - : CalibrationModelPath.Trim(), + : ResolveConfigPath(CalibrationModelPath, configDirectory), ComplexContourChannelModelPath = string.IsNullOrWhiteSpace(ComplexContourChannelModelPath) ? fallback.ComplexContourChannelModelPath - : ComplexContourChannelModelPath.Trim(), + : ResolveConfigPath(ComplexContourChannelModelPath, configDirectory), BioacousticWitnessProfileId = string.IsNullOrWhiteSpace(BioacousticWitnessProfileId) ? fallback.BioacousticWitnessProfileId : BioacousticWitnessProfileId.Trim(), EnableComplexContourRuntime = EnableComplexContourRuntime || fallback.EnableComplexContourRuntime, }; } + + private static string ResolveConfigPath(string path, string? configDirectory) + { + var trimmed = path.Trim(); + return Path.IsPathRooted(trimmed) || string.IsNullOrWhiteSpace(configDirectory) + ? trimmed + : Path.GetFullPath(Path.Combine(configDirectory, trimmed)); + } } public sealed class MimirStreamConfig diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 59a6cc7..d20b30f 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -106,3 +106,4 @@ {"ts": "2026-05-25T02:53:00+01:00", "type": "verification", "status": "ok", "note": "Added persisted complex contour replay receipt generation. `dotnet run -c Release --no-build --project src/Mimir.BufferSmoke/Mimir.BufferSmoke.csproj -- --complex-contour-replay-panel --output calibration/bioacoustic/complex-contour-replay-panel.json` writes the four stored/fresh shotgun/cardioid cases with delay error, phase MAE, reflection taps, and strongest band residuals. Build passes and synthetic 192 kHz reflection smoke still reports 5.249 us error."} {"ts": "2026-05-25T03:40:00+01:00", "type": "implementation", "status": "partial", "note": "Built explicit complex contour channel learning and evaluation. `--learn-complex-contour-channel-model` learns path-scoped per-band delay/phase correction and reflection taps from `calibration/bioacoustic/complex-contour-replay-panel.json`, writing `calibration/bioacoustic/complex-contour-channel-model.json`. `MimirDirectPathTracker` now applies supplied channel-model phase/group-delay correction and downweights bands outside the usable learned surface. `--evaluate-complex-contour-channel-model` writes `calibration/bioacoustic/complex-contour-channel-model-evaluation.json`: current model improves 3/4 absolute path-seed errors, mean absolute path error by 2.137 us, and mean cluster MAE by 0.713 samples; fresh cardioid reaches 0.202 us from seed, but stored cardioid worsens from 15.817 us to 17.476 us. Treat the model as explicit calibration evidence, not default runtime authority, until more captures prove stability."} {"ts": "2026-05-25T04:25:00+01:00", "type": "implementation", "status": "partial", "note": "Moved the complex contour receiver from artifact-only replay into runtime shape. `MimirComplexContourRuntimeAnalyzer` reads Float32 samples from `MimirRollingStreamBuffer`, maps runtime time into the configured bioacoustic witness profile, runs the complex contour matched-filter/direct-path tracker, applies path-scoped `MimirComplexContourChannelModelDocument` corrections, and emits `evidence=complex-contour` synchronization reports. `MimirRuntime` now emits `MimirBioacousticContestantRenderer` audio when `enableComplexContourRuntime` is true, so the live sound and contour decoder share one song profile. Synthetic proof: `--complex-contour-runtime-self-test` at 192 kHz recovers a 693.5-sample delay with 0.219 us error from runtime-shaped rolling buffers. Real Scarlett loopback/mic proof remains the next gate."} +{"ts": "2026-05-25T06:37:00+01:00", "type": "verification", "status": "partial", "note": "Ran a fresh live Scarlett complex-contour pass through the physical output/input path. Rendered `artifacts/asio/canary-packet-live-20260525-063229-f32.raw`, played it through Focusrite ASIO at 192 kHz, and captured `artifacts/asio/scarlett-canary-packet-live-20260525-063229-f32.raw` from all four inputs. Loopback 1 -> Loopback 2 measured -0.014 us with 216 direct hits and 0.008 sample MAE. With `calibration/bioacoustic/complex-contour-channel-model.json` loaded, shotgun measured -3.984 us from prior seed and cardioid measured +1.547 us from prior seed. This proves fresh meatspace viability, but physical mic confidence remains low; next work is stronger direct-path confidence and independent distance/path truth. Receipt: `calibration/bioacoustic/complex-contour-live-20260525-063229.md`."} diff --git a/state/map.yaml b/state/map.yaml index 0dd4845..2fea588 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -246,6 +246,14 @@ accepted_design: rolling buffers, and publishes `evidence=complex-contour` reports. The synthetic runtime-shaped proof `--complex-contour-runtime-self-test` at 192 kHz recovers a 693.5-sample delay with about 0.219 us error. + A fresh live Scarlett proof is preserved at + `calibration/bioacoustic/complex-contour-live-20260525-063229.md`: + Focusrite ASIO playback/capture measured Loopback 1 -> Loopback 2 at + -0.014 us, shotgun at -3.984 us from prior seed, and cardioid at +1.547 us + from prior seed with the current channel model. This is fresh meatspace + evidence through DAC/speaker/room/mic/ADC, but physical confidence remains + low, so the next cut is stronger direct-path confidence and independent + path truth. `calibration/bioacoustic/complex-contour-replay-panel.json` persists the current four-case replay receipt. Acoustic robustness remains open.