Add chirp-bin watermark decoder

This commit is contained in:
Meta Vens 2026-05-22 19:50:02 +01:00
commit d79bae17bb
8 changed files with 688 additions and 25 deletions

View file

@ -51,12 +51,11 @@ timing evidence Mimir is allowed to emit:
timing witness by estimating delay between the loopback buffer and each mic
buffer.
- `hybrid`: prefer passive program-audio evidence when confidence is high, then
emit a watermark when confidence falls. Today the passive side uses bounded
GCC-PHAT-style phase correlation and the fallback still uses the old active
chirplet pilot in half-second chunks. The intended watermark is the
dechirp/FFT-friendly chirp-bin codebook from the decoder research notes,
shaped and low-gain enough to sit inside the program audio instead of
announcing itself like a lab sweep.
emit a watermark when confidence falls. The passive side uses bounded
GCC-PHAT-style phase correlation. The active fallback now uses
`MimirChirpBinTimeline`: a fixed-slope chirp-bin watermark whose symbols are
decoded by one dechirp and a fixed Goertzel bin bank instead of dense sliding
matched filters.
The mode belongs to the runtime, not the decoder. The decoder should consume
known timing evidence; it should not decide whether Mimir is allowed to make
@ -71,6 +70,13 @@ evidence and carry zero confidence. A single passive window is also capped below
certainty; full confidence belongs to repeated coherent state over time, not
one attractive correlation peak.
The active watermark path is deliberately receiver-cheap. `MimirChirpBinTimeline`
uses a common chirp duration, chirp slope, and Hann window for every symbol.
Symbol identity is the dechirped frequency bin. The synthetic invariant is
`dotnet run --project .\src\Mimir.BufferSmoke\Mimir.BufferSmoke.csproj -- --chirp-bin-self-test`;
it renders the chirp-bin timeline, decodes by dechirp plus Goertzel bins, and
requires code-valid triplet anchors plus a stable source clock.
## Next Cut
The current diagnostic witness is `native/probes/wasapi_audio_cadence`, which
@ -186,13 +192,10 @@ timeline anchors. Current synthetic proof detects all 15 emitted chirps, keeps
device runs still depend on loopback capture staying live; the local Scarlett
loopback has intermittently stopped advancing during short headless sniffs.
This matcher is a proof, not the final hot path. `BuildChirpletEnergyTrace`
still behaves like a dense sliding matched-filter bank. The current research
note at `research/chirplet-sync-decoder/summary.md` points at the better
receiver shape: design the emitted symbol codebook so a mic can dechirp a
candidate event window and classify symbols by FFT or Goertzel bins. The
transmitter is ours; do not preserve arbitrary symbol shapes if they force the
receiver to spend a CPU core proving they exist.
The older `MimirChirpletTimeline` matcher is now the chirp-only lab path, not
the hybrid fallback. `BuildChirpletEnergyTrace` still behaves like a dense
sliding matched-filter bank and should not retake the hot path. The active
hybrid watermark belongs to the chirp-bin machine.
Next, replace the diagnostic bridge with native audio capture workers that
append typed blocks into `Mimir.Runtime`, then expose buffer depth, clock state,

View file

@ -79,6 +79,10 @@ a named invariant that the native runtime cannot protect yet.
path. It estimates loopback-to-mic delay with PHAT-weighted cross-spectrum
correlation so music can act as the default timing witness before any audible
watermark is needed.
- `MimirChirpBinTimeline` is the active hybrid watermark path. It renders a
fixed-slope chirp-bin codebook and decodes symbols with one dechirp plus
fixed Goertzel bins, then feeds the same de Bruijn triplet timeline-anchor
machine. Use `--chirp-bin-self-test` to prove this path without hardware.
- `MimirVideoFrameDescriptor` for dimensions, pixel format, stride, device
timestamp, and native/GPU handle metadata.
- `IMimirVideoCaptureDriver` and `MimirVideoCaptureDriverSource` as the live
@ -118,10 +122,8 @@ a named invariant that the native runtime cannot protect yet.
decoder through real loopback and microphone paths so every correctly heard
triplet becomes a deterministic timeline anchor before the actuator moves
samples.
5. Replace the active chirplet fallback in hybrid mode with shaped watermark
emission when passive confidence drops. The watermark codebook should be
designed for dechirp/FFT or Goertzel classification, not dense sliding
matched filters.
5. Prove the chirp-bin hybrid fallback through real loopback and microphones
with probe durations long enough to keep loopback and mic windows live.
6. Bind Aquarium 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