Make song contours the active sync authority

This commit is contained in:
Meta Vens 2026-05-24 23:31:41 +01:00
commit f134ea6bca
9 changed files with 108 additions and 88 deletions

View file

@ -184,13 +184,13 @@ half-second PCM segments ahead of the audio cursor. Each motif is a short phrase
of formant-rich syllables with log-frequency contour and rhythm offsets, so the
code is carried by both spectral shape and timing.
The intended decoder is a compact constrained motif transform, not a generic
time-frequency explorer and not an outlier filter around bad guesses. Mimir owns
the emitter, so the receiver projects each mic stream against the known motif
dictionary, produces transform frames with multiple word candidates, and maps
the best coherent word identities directly to canonical events. A word becomes a
canonical timeline anchor when its motif likelihood and neighboring anchors
agree on one local sample clock. A decoded anchor
The intended decoder is a compact constrained song-contour transform, not a
generic time-frequency explorer and not an outlier filter around bad guesses.
Mimir owns the emitter, so the receiver keeps its ear open for known song words
and maps each successful call directly to canonical time. A word is not a
single scalar event: syllable onsets, bends, formants, rhythm offsets, payload
ornaments, speaker tint, and log-mel contour all expose local time/frequency
constraints. One call can pin a cluster of anchors at once. A decoded anchor
means observed sample offset `S` corresponds to emitted event time `T`. A stream
of anchors fits the source clock directly:
@ -201,14 +201,15 @@ observed_sample = source_offset + canonical_seconds * effective_sample_rate
Delay and sampling-rate offset are derived by comparing the loopback clock fit
to each mic clock fit over common canonical time. The state tracker is not
allowed to launder invalid words into plausible timing. If a stream cannot
produce at least one matched canonical anchor, it has not decoded timing for
produce at least one matched canonical song word, it has not decoded timing for
that window. Reports carry rounded integer delay, fractional delay, and the
count/confidence of timeline-symbol anchors used to derive the report.
count/confidence of contour anchors used to derive the report.
The same timeline starts the frequency-response path. Each active bioacoustic
decode carries per-band response evidence for the source set, whether or not
each source earns a timing report. The older chirp-bin calibration model remains
the controlled ASIO reference surface for response/confusion/delay captures:
The same song starts the frequency-response path. Each active bioacoustic decode
carries per-band and per-contour response evidence for the source set, whether
or not each source earns a timing report. The older chirp-bin calibration model
remains the controlled ASIO reference surface for response/confusion/delay
captures:
use `Mimir.BufferSmoke --calibrate-chirp-bin-asio-f32` to render that reference
timeline, optionally capture it through the ASIO worker with `--capture-asio`,
compute the response/confusion/delay model, and persist it for decoder tuning.
@ -225,10 +226,10 @@ bioacoustic timeline queued, polls sources, and updates sync analysis on a fixed
`MIMIR_SYNC_TELEMETRY_SECONDS` enables console telemetry for live tests. Current
runtime testing proves Fensalir output wakes the Scarlett loopback and the mic
buffers stay live. The next failure is physical capture proof: the same
canonical motif anchors need to stay stable through loopback, room mics, device
canonical song-contour anchors need to stay stable through loopback, room mics, device
clocks, and codec/network paths.
## Chirplet Calibration Model
## Retained Reference Calibration
```mermaid
flowchart TD
@ -237,7 +238,7 @@ flowchart TD
B --> D["room + speakers + mics"]
C --> E["loopback rolling buffer"]
D --> F["mic rolling buffers"]
E --> G["matched chirplet traces"]
E --> G["matched reference traces"]
F --> G
G --> H["symbol likelihood events"]
H --> L["timeline anchors"]
@ -248,7 +249,7 @@ flowchart TD
I --> K["frequency response normalization"]
```
The chirplet timeline owns three facts:
The retained chirplet/chirp-bin timelines own three reference facts:
- **Emission**: the PCM that Fensalir sends to the speakers.
- **Timing witness**: the matched-filter atom bank used to find the stream in
@ -256,7 +257,7 @@ The chirplet timeline owns three facts:
- **Response witness**: the per-band atoms used to measure how strongly each
mic hears each emitted band.
Continuous chirplet evidence gives both the current delay and the drift/SRO by
Continuous active song evidence should give both the current delay and the drift/SRO by
watching delay change over time. Per-band energy over the same stream gives the
normalization curve. The important constraint is that all three measurements
must be tied to the same emitted timeline, not three separately invented probes.
@ -267,21 +268,12 @@ band set but still fails pairwise timing because no canonical events overlap
the loopback path. That is not a blank failure anymore; it is calibration data
for the next codebook/weighting cut.
The symbol layer is intentionally redundant. It does not rely on one fixed
frequency shelf: timing gaps, chirp duration, start band, and glide shape all
contribute so poor mic frequency response does not erase the whole code.
`MimirChirpletSymbolCodebook` owns the symbol definitions so timeline ordering
does not smuggle acoustic shape decisions into bit arithmetic. Every symbol has
a unique chirp shape; rhythm remains additional evidence, not a substitute for
symbol separability. The transform uses sine/cosine chirplet kernels for each
symbol, so timing does not depend on the receiver preserving the emitter's
absolute phase. Run `dotnet run --project .\src\Mimir.BufferSmoke\Mimir.BufferSmoke.csproj -- --chirplet-self-test`
to render two seconds of canonical timeline audio and decode it back to
timeline anchors. Current synthetic proof detects all 15 emitted chirps, keeps
13 possible triplet anchors for events 0 through 12, fits the clock at
47999.999990 Hz, and holds mean absolute anchor error to 0.000014 samples. Real
device runs still depend on loopback capture staying live; the local Scarlett
loopback has intermittently stopped advancing during short headless sniffs.
The active symbol layer is now the song contour. It does not rely on one fixed
frequency shelf or a coded sequence: syllable timing, contour bends, formants,
payload ornaments, speaker tint, and local spectral flux all contribute so poor
mic response does not erase the whole code. The old chirplet self-test remains
available as historical proof of sub-frame math, but it must not retake
authority over the active runtime path.
The older `MimirChirpletTimeline` matcher is a diagnostic/reference artifact,
not the active runtime path. `BuildChirpletEnergyTrace` still behaves like a

View file

@ -12,9 +12,10 @@ ask only "which bin fired?" It should ask:
```text
which motif contour did I hear?
which self-identifying word did that contour encode?
which self-identifying song word did that contour encode?
which speaker vocabulary emitted it?
what delay and clock fit make the heard words coherent?
which time and frequency anchors did that one call expose?
what delay and clock fit make the heard anchors coherent?
what did this room/mic path do to the spectrum?
```
@ -27,10 +28,15 @@ what did this room/mic path do to the spectrum?
- Each word contains four short syllables.
- Each syllable carries a log-frequency glide plus formant-like partials.
- Motif rhythm, contour, syllable duration, root, and speaker tint vary by word.
- No de Bruijn grammar is used in the active bioacoustic path. A word identifies
its canonical event directly inside the current operating horizon.
- The decoder emits motif candidates, direct word anchors, a source clock fit,
and per-band response evidence.
- No de Bruijn grammar is used in the active bioacoustic path. One heard song
word identifies its canonical event directly inside the current operating
horizon.
- The decoder emits motif candidates, direct song-word anchors, a source clock
fit, and per-band response evidence.
- A song word is not one scalar chirp. It is a contour packet: multiple
syllable onsets, bends, formants, rhythm offsets, payload ornaments, and
speaker-colored spectral features all become anchors in log-mel space. One
successful call can pin a cluster of time/frequency constraints at once.
- Runtime emission sends the left vocabulary to the left speaker and the right
vocabulary to the right speaker, so microphones can learn each side of the
room separately.
@ -45,11 +51,11 @@ watermark target.
`MimirBioacousticTimeline` owns:
- motif codebook shape;
- song-word codebook shape;
- deterministic phrase schedule;
- PCM rendering for active emission;
- streaming motif scoring;
- direct word anchor decoding;
- direct contour-anchor decoding;
- source clock fitting;
- response-band evidence.
@ -72,7 +78,7 @@ Birdsong survives ugly channels because the information is redundant:
- formant envelope survives when one band dies;
- speaker-specific variants expose room asymmetry;
- repeated local structure gives the receiver more than one way to recover time
and response.
response, and local payload identity.
That is the physical path Mimir needs. A phone mic, camera mic, Scarlett input,
or network receiver should be able to recognize canonical time from a damaged
@ -112,34 +118,34 @@ dotnet run --project .\src\Mimir.BufferSmoke\Mimir.BufferSmoke.csproj -- --rende
## Next Cut
The current runtime decoder still uses a motif matched-filter proof. The smoke
harness now carries the next receiver shape: indexed MFCC/log-mel word
fingerprints with path-degradation augmentation. The next coherent cut is to
promote that shape into a true streaming log-mel receiver:
The current physical receipt path uses the canary packet song as the first
serious contour-anchor witness. The next coherent cut is to promote that shape
into the live streaming log-mel receiver:
```text
audio window
-> log-mel / constant-Q evidence surface
-> motif/formant/contour candidates
-> projection-hash / ANN candidate retrieval
-> direct word identity decode over a tiny candidate set
-> global delay and clock hypothesis
-> contour packet proposals
-> direct song-word identity over a tiny candidate set
-> intra-call time/frequency anchor extraction
-> global delay, clock, and path hypothesis
-> path response model
```
Do not add a pile of threshold rules to make one room capture look good. The
right extension is learned path weighting over motif parts: which contours,
partials, and time gaps survive each output/mic path.
right extension is learned path weighting over contour parts: which syllable
onsets, bends, formants, payload ornaments, partials, and time gaps survive each
output/mic path.
The latest training receipt says identity can survive the current
mel-cepstral degradation panel, but timing collapses under warped domains. That
points the next cut at a global delay/clock/path hypothesis over detected words,
not a larger brute-force dictionary.
That cut has started in the harness. `--bioacoustic-train` now persists a
global clock hypothesis per result and scores timing through its confidence
rather than raw absolute word offset. The latest corrected receipt is
`artifacts/bioacoustic-training/bioacoustic-20260524-150729/`; it shows compact
indexing still wins clean throughput, baseline indexing remains steadier under
degradation, highband indexing has real warped-path value, and anchor density
must become its own benchmark metric.
That cut has started in the harness. `--bioacoustic-train` persists a global
clock hypothesis per result, and `--calibrate-contestant-asio-f32` now persists
the first physical packet-song response model. The current Scarlett canary
receipt clears 10x realtime and proves that a single song word can own local
identity; the remaining work is to make each syllable/formant contour emit
enough stable anchors that physical mic residuals collapse from tens of
microseconds toward the one-microsecond target.

View file

@ -837,7 +837,10 @@ Blocks:
Invariant:
- A receiver with only the codebook, schedule, and its local audio buffer can
recover canonical time once it hears a valid motif word.
recover canonical time once it hears a valid song word.
- The active path is not sequence-coded. A song word's log-mel contour,
syllable timing, formants, payload ornaments, speaker tint, and spectral flux
are the local anchor field.
## Stage 9: Chirp-Bin Reference Timeline
@ -846,6 +849,8 @@ Invariant:
Owns:
- The controlled chirp-bin calibration/reference codebook and receiver.
- Historical sequence-coded reference machinery only. This is not the active
packet-song receiver.
Core state:

View file

@ -70,7 +70,10 @@ a named invariant that the native runtime cannot protect yet.
a low-gain birdsong-like word language: 128 self-identifying word positions,
left-speaker and right-speaker variants, four formant-rich syllables per word,
rhythm variation, and direct word identity so a correctly decoded word
identifies canonical timeline position. Runtime active sync now reports
identifies canonical timeline position. The active receiver is no longer a
sequence decoder: each song contour should expose multiple time/frequency
anchors through syllable timing, bends, formants, payload ornaments, rhythm,
speaker tint, and log-mel shape. Runtime active sync now reports
`evidence=bioacoustic`.
- `MimirChirpletTimeline` owns the older structured chirplet calibration stream,
PCM segment rendering, matched timing trace, and per-band response kernels.
@ -215,13 +218,12 @@ a named invariant that the native runtime cannot protect yet.
other cameras.
2. Feed those drivers into `MimirVideoCaptureDriverSource` and prove sustained
frame cadence in the rolling buffers.
3. Use bioacoustic motif response profiles from real microphones to tune
contour, formant, band, gain, rhythm weighting, and left/right speaker
separation without weakening the standalone word-identity receiver invariant.
Keep chirp-bin calibration artifacts as reference data, not the runtime
target. Promote the `--bioacoustic-train` receipt shape into a real
calibration loop: detected words should feed a global delay/clock/path
hypothesis and learned per-output/mic response, not per-case threshold rules.
3. Promote the packet-song physical calibration receipt into the runtime
receiver. The live decoder should keep its ear open for self-identifying
song contours, extract intra-call time/frequency anchors from log-mel parts,
apply learned per-output/mic path weighting, and feed a global
delay/clock/path hypothesis. Keep chirp-bin calibration artifacts as
reference data, not the runtime target.
4. Add the synchronization actuator: drive a variable-rate resampler and
fractional delay line per non-reference stream from the smoothed
`MimirAudioSynchronizationState`. First, prove the bioacoustic motif decoder