Add bioacoustic training receipts

This commit is contained in:
Meta Vens 2026-05-24 11:41:04 +01:00
commit 84d33992e8
91 changed files with 2416 additions and 44 deletions

View file

@ -99,6 +99,10 @@ Expected state:
- `--bioacoustic-cepstral-smoke` round-trips the active call through a degraded
mel-cepstral representation, then decodes word identity with an augmented
projection-hash MFCC index instead of brute-forcing every word waveform.
- `--bioacoustic-train` runs a hypothesis panel over decoder shapes and writes
CultCache receipts plus pre-warp, post-warp, and reconstructed-from-detections
WAV artifacts. See [[bioacoustic-training-harness|Bioacoustic Training
Harness]].
Render a raw Float32 preview:
@ -126,3 +130,8 @@ audio window
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.
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.

View file

@ -0,0 +1,84 @@
# Bioacoustic Training Harness
## Purpose
The bioacoustic receiver is tuned by benchmark receipts, not by console optimism.
`Mimir.BufferSmoke --bioacoustic-train` runs a small hypothesis panel over the
current motif language and records both queryable CultCache evidence and audio
artifacts.
This is authoring and calibration machinery. It is allowed to allocate, score,
serialize, and leave receipts. It is not the runtime hot loop.
## Command
```powershell
dotnet run --project .\src\Mimir.BufferSmoke\Mimir.BufferSmoke.csproj -- --bioacoustic-train --sample-rate 48000 --seconds 0.5 --output artifacts/bioacoustic-training
```
Each run writes:
- `bioacoustic-training.cc`: typed CultCache results with provenance, decoder
settings, degradation name, scores, timing, and artifact hashes.
- `run-summary.json`: short best-result summary.
- `source-pre-warp.wav`: the emitted source song.
- `<hypothesis>/<degradation>/pre-warp.wav`: source audio for that scored case.
- `<hypothesis>/<degradation>/post-warp.wav`: mel-cepstral warp/blur round-trip.
- `<hypothesis>/<degradation>/reconstructed-from-detections.wav`: song rebuilt
from detected word features.
- `<hypothesis>/<degradation>/summary.json`: per-case receipt mirror.
## Current Hypotheses
- `baseline-mfcc-index`: current indexed MFCC/log-mel smoke shape.
- `compact-fast-index`: smaller feature and hash surface to test speed against
identity loss.
- `robust-wide-index`: wider cepstral/augmentation surface to test degraded-path
survival.
- `highband-room-index`: upper-band-biased receiver to avoid low room junk.
The harness intentionally scores identity, timing, and speed separately:
```text
total = identity * 0.62 + timing * 0.18 + speed * 0.20
```
Aggregate score is a triage knife. Identity tells whether the word language
survived. Timing tells whether detected words landed on the canonical clock.
Speed tells whether the receiver shape can plausibly become a streaming machine.
## Latest Local Receipt
Run:
```text
artifacts/bioacoustic-training/bioacoustic-20260524-103438/
```
Best aggregate result:
```text
compact-fast-index / clean-roundtrip
total=0.700 identity=0.997 timing=0.357 speed=0.085 realtime=4.2x
```
Useful observations:
- `compact-fast-index` is faster on clean/light blur, but collapses under warp.
- `baseline-mfcc-index` keeps better identity under light warp than compact.
- `highband-room-index` wins some blur/warp-blur cases, which supports
room-path band selection as a real tuning axis.
- `robust-wide-index` is not currently worth its extra CPU except as pressure
for heavier blur/warp cases.
- Timing mean absolute error is still poor under warped cepstral reconstruction.
That means the next cut is global delay/clock/path hypothesis over detected
words, not just “more cepstra.”
## Architecture Pressure
The benchmark now uses CultLib at the BufferSmoke edge, but Mimir itself should
be a CultMesh app. Phones, microcontrollers, Raven, and Starfire need typed
state surfaces for schedule/codebook snapshots, calibration receipts, learned
path response, and work offload. CultCache receipts are the durable proof layer;
the next runtime cut should promote the live state contracts into mesh-owned
documents rather than leaving them as harness-only artifacts.

View file

@ -48,7 +48,9 @@ a named invariant that the native runtime cannot protect yet.
to render the active motif timeline into memory and verify that the decoder
recovers direct word anchors. Use `--standalone-bioacoustic-self-test` to
verify that a receiver with only the codebook/schedule can recover canonical
source offset from delayed audio.
source offset from delayed audio. Use `--bioacoustic-train` to run the
indexed cepstral receiver hypothesis panel and write CultCache/audio receipts
under `artifacts/bioacoustic-training/`.
- `native/probes/wasapi_audio_cadence` captures WASAPI mic or render-loopback
block metadata and emits `audio-block` JSON events for the diagnostic runtime
adapter. It can probe requested shared/exclusive formats so driver state is
@ -187,7 +189,9 @@ a named invariant that the native runtime cannot protect yet.
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.
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.
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