From 3d412cd95af4edc76f1a84946186df51ebe69be0 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 19 May 2026 10:58:24 +0100 Subject: [PATCH] Quarantine Python audio publishers --- audio_field/probe_bands.py | 17 +++++ audio_field/profile.py | 23 +++++++ docs/aquarium-spatial-audio.md | 8 +-- docs/audio-field.md | 36 +++------- docs/implementation-plan.md | 11 ++-- .../diagnostics/audio_live_field.py | 21 ++---- .../diagnostics/audio_phase_field.py | 21 +----- .../diagnostics/faust_mic_field.py | 4 +- notes/current-system-map.md | 4 +- notes/fresh-workspace-handoff.md | 7 ++ scripts/start-live-audio-phase-field.ps1 | 66 ------------------- scripts/start-live-faust-mic-field.ps1 | 35 ---------- scripts/stop-live-audio-phase-field.ps1 | 30 --------- scripts/stop-live-faust-mic-field.ps1 | 30 --------- state/evidence.jsonl | 1 + state/map.yaml | 20 ++---- tests/test_active_probe.py | 2 +- tests/test_spatial_audio_cultcache.py | 2 +- 18 files changed, 86 insertions(+), 252 deletions(-) create mode 100644 audio_field/probe_bands.py create mode 100644 audio_field/profile.py rename scripts/stream_live_audio_field.py => localcast/diagnostics/audio_live_field.py (96%) rename scripts/stream_phase_field.py => localcast/diagnostics/audio_phase_field.py (93%) rename scripts/stream_faust_mic_field.py => localcast/diagnostics/faust_mic_field.py (95%) delete mode 100644 scripts/start-live-audio-phase-field.ps1 delete mode 100644 scripts/start-live-faust-mic-field.ps1 delete mode 100644 scripts/stop-live-audio-phase-field.ps1 delete mode 100644 scripts/stop-live-faust-mic-field.ps1 diff --git a/audio_field/probe_bands.py b/audio_field/probe_bands.py new file mode 100644 index 0000000..31d9507 --- /dev/null +++ b/audio_field/probe_bands.py @@ -0,0 +1,17 @@ +"""Probe-band selection helpers without diagnostic runtime dependencies.""" + + +def parse_probe_band(value: str) -> tuple[float, float]: + parts = value.split(":") + if len(parts) != 2: + raise ValueError(f"probe band must be start:end Hz, got {value!r}") + return float(parts[0]), float(parts[1]) + + +def ultrasonic_probe_band(sample_rate: int) -> tuple[float, float]: + nyquist = 0.5 * float(sample_rate) + end_hz = min(22_000.0, nyquist - 1200.0) + start_hz = min(18_500.0, end_hz - 2500.0) + if end_hz <= 16_000.0 or start_hz <= 0.0: + raise ValueError(f"sample rate {sample_rate} leaves no useful ultrasonic probe band") + return start_hz, end_hz diff --git a/audio_field/profile.py b/audio_field/profile.py new file mode 100644 index 0000000..44ce4bc --- /dev/null +++ b/audio_field/profile.py @@ -0,0 +1,23 @@ +"""Audio-field profile helpers with no runtime device dependencies.""" + +from localcast.sensor_fusion import phase_source_id_for_microphone + + +HOST_SOURCE_BY_MIC_ID = { + "mic_focusrite_local": "host-focusrite", + "mic_focusrite_neighbor": "co-streamer-focusrite", +} + + +def source_id_for_microphone(mic: dict) -> str | None: + return str( + mic.get("phaseSourceId") + or mic.get("sourceId") + or HOST_SOURCE_BY_MIC_ID.get(str(mic.get("id", ""))) + or phase_source_id_for_microphone(mic) + or "" + ) + + +def local_microphones(profile: dict, machine: str) -> list[dict]: + return [mic for mic in profile.get("microphones", []) if mic.get("machine") == machine and source_id_for_microphone(mic)] diff --git a/docs/aquarium-spatial-audio.md b/docs/aquarium-spatial-audio.md index d87d57f..061ebe3 100644 --- a/docs/aquarium-spatial-audio.md +++ b/docs/aquarium-spatial-audio.md @@ -60,19 +60,19 @@ Mic-field document type: - graph id: `localcast.faust.voice_separation.v1` - Faust source: `faust/localcast_voice_separation.dsp` -Publisher smoke command: +AmbiX replay smoke command: ```powershell .\.venv\Scripts\python.exe .\scripts\stream_spatial_audio.py --input .\calibration\runs\audio-full-sync-20260518-165751\field-foa-ambix.wav --loop --duration 5 --smoke-readback ``` -Faust mic-field publisher: +Faust mic-field replay smoke command: ```powershell -.\scripts\start-live-faust-mic-field.ps1 +.\.venv\Scripts\python.exe -m localcast.diagnostics.faust_mic_field --input .\calibration\runs\audio-full-sync-20260518-165751\field-cleaned.wav --loop --duration 5 --smoke-readback ``` -This publishes the aligned six-channel field directly to Aquarium/Faust while preserving the AmbiX path as a compatibility bed. Stop it with `.\scripts\stop-live-faust-mic-field.ps1`. +This exercises the old mic-field document shape. Production voice separation should read typed reservoir/CultNet data from the native live path; Python is not the hot publisher. Source-event analysis command: diff --git a/docs/audio-field.md b/docs/audio-field.md index c4645be..6ad52e1 100644 --- a/docs/audio-field.md +++ b/docs/audio-field.md @@ -124,41 +124,23 @@ For dense runtime calibration, emit a low-level multiband chirplet texture inste `analyze-probe-train` is the offline live-fit evidence path: it uses each event's band-specific chirplet, gates weak loopback/mic detections, estimates phase-derived delay deltas across frequency bands, and updates a smoothed phase/frequency mapping. Coarse delays still include device latency; the volumetric room solve must fit latency, drift, phase response, and acoustic path jointly. -Publish live extracted phase-field meaning from an aligned field and known program/loopback reference: +Replay extracted phase-field meaning from an aligned field and known program/loopback reference: ```powershell -.\.venv\Scripts\python.exe .\scripts\stream_phase_field.py --field .\calibration\runs\\field-program-cleaned.wav --reference .\calibration\runs\\ground_truth_loopback.wav --cache .\calibration\runs\audio-phase-field.msgpack +.\.venv\Scripts\python.exe -m localcast.diagnostics.audio_phase_field --field .\calibration\runs\\field-program-cleaned.wav --reference .\calibration\runs\\ground_truth_loopback.wav --cache .\calibration\runs\audio-phase-field.msgpack ``` -This is not a phase oscilloscope. Raw phase bands stay internal. The live cache publishes consequences: per-source delay correction, distance-equivalent delta, coherence, fit error, confidence, reference-bleed estimate, suppression weight, correction energy, and whether the active probe optimizer should spend chirps. +This is not a phase oscilloscope. Raw phase bands stay internal. The diagnostic document publishes consequences: per-source delay correction, distance-equivalent delta, coherence, fit error, confidence, reference-bleed estimate, suppression weight, correction energy, and whether the active probe optimizer should spend chirps. -Close the confidence loop by letting the phase-field stream schedule strategic active probes: +Exercise the confidence loop by letting the replay schedule strategic active probes: ```powershell -.\.venv\Scripts\python.exe .\scripts\stream_phase_field.py --field .\calibration\runs\\field-program-cleaned.wav --reference .\calibration\runs\\ground_truth_loopback.wav --cache .\calibration\runs\audio-phase-field.msgpack --maintain-confidence --ultrasonic-probes --play-probes +.\.venv\Scripts\python.exe -m localcast.diagnostics.audio_phase_field --field .\calibration\runs\\field-program-cleaned.wav --reference .\calibration\runs\\ground_truth_loopback.wav --cache .\calibration\runs\audio-phase-field.msgpack --maintain-confidence --ultrasonic-probes --play-probes ``` `--maintain-confidence` converts low-confidence phase-field state into `ActiveProbeOptimizer` requests, writes emitted chirplets under `calibration/runs/active-probes`, and appends `active-probes.jsonl`. Probe files rotate through fixed slots and the manifest rotates at a byte cap, because a calibration loop that creates infinite tiny WAV files is just a storage leak with a physics degree. `--play-probes` sends the emitted chirplet to the selected output device through `sounddevice`; omit it for dry-run scheduling. `--ultrasonic-probes` uses the highest safe band under Nyquist, roughly `18.5-22 kHz` at 48 kHz. This can fail silently in the physical world if the speaker, mic, driver, or resampler refuses to carry that band; the confidence feedback is the judge, not the command line's self-esteem. -For the current deadline rig, `scripts/stream_live_audio_field.py` owns the live local path: - -```powershell -.\.venv\Scripts\python.exe .\scripts\stream_live_audio_field.py --profile .\config\audio-field.example.json --loopback-query Scarlett --maintain-confidence --play-probes --probe-output-query Scarlett -``` - -It publishes both `audio-mic-field.msgpack` and `audio-phase-field.msgpack` from visible local mics, records missing distributed channels as explicit placeholders, captures Scarlett loopback as the known reference, and resamples probe playback when the Scarlett output is exposed as 44.1 kHz while the capture field remains 48 kHz. Active probe scheduling is restricted to source ids with a live local capture device; placeholders stay in the cache for channel stability, but the calibration loop does not waste chirps trying to synchronize silence. - -For the current live app, start the dense harmonic confidence-maintenance loop: - -```powershell -.\scripts\start-live-audio-phase-field.ps1 -``` - -That launcher runs `stream_phase_field.py` in realtime loop mode with playback enabled, dense harmonic probes, a near-ultrasonic band, `-24 dBFS` level cap, 80 ms probe textures, and 48 harmonic voices. Stop it with: - -```powershell -.\scripts\stop-live-audio-phase-field.ps1 -``` +The old Python live local-capture bridge is quarantined as `localcast.diagnostics.audio_live_field`. It documents the deadline experiment, but production local mic and loopback capture now belongs in native workers that append typed sample handles through `LocalcastProducer`. Record local mics while playing one speaker sweep. Use the output rate that the device probe says is real: @@ -203,13 +185,13 @@ Encode an offline aligned six-channel WAV to FOA AmbiX: .\.venv\Scripts\python.exe .\scripts\audio_field.py encode-foa --profile .\config\audio-field.json --input .\calibration\runs\\field-aligned.wav --output .\calibration\runs\\field-foa-ambix.wav ``` -Publish the same aligned six-channel field directly to Aquarium/Faust for voice separation: +Replay the same aligned six-channel field directly to the old mic-field document for Faust smoke tests: ```powershell -.\scripts\start-live-faust-mic-field.ps1 +.\.venv\Scripts\python.exe -m localcast.diagnostics.faust_mic_field --input .\calibration\runs\\field-cleaned.wav --loop --realtime --smoke-readback ``` -This writes `localcast.audio.mic_field` into `calibration/runs/audio-mic-field.msgpack` with channel roles and graph id `localcast.faust.voice_separation.v1`. The Faust graph lives at `faust/localcast_voice_separation.dsp` and has six inputs plus six stem outputs: host voice, co-streamer voice, ambient, transients, local loopback placeholder, and co-streamer loopback placeholder. +This writes `localcast.audio.mic_field` into `calibration/runs/audio-mic-field.msgpack` with channel roles and graph id `localcast.faust.voice_separation.v1`. It is a diagnostic replay path. The live path is native capture into the rolling reservoir, then Aquarium/Faust consumption. Suppress room/transient witness energy before FOA encoding: diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 7fec089..20e970e 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -87,17 +87,16 @@ shape removes independent per-kind storage from the live foundation. - Live phase-field meaning: - `audio_field.phase_meaning` extracts actionable delay, coherence, confidence, suppression, correction-energy, and active-probe need from internal phase/chirplet evidence. - `localcast.audio.phase_field` is a typed CultCache document at `calibration/runs/audio-phase-field.msgpack`. - - `scripts/stream_phase_field.py` publishes the live meaning document from an aligned mic field plus known program/loopback reference without exposing raw phase bands as the renderer API. - - `stream_phase_field.py` also writes `audio-phase-field-status.json`, which declares whether the phase estimator is running against replayed WAVs or closed-loop live capture. Current deadline mode is explicit `wav-replay` with open-loop probe playback. + - `localcast.diagnostics.audio_phase_field` can replay an aligned mic field plus known program/loopback reference into the phase-field document for diagnostics. It is not a live bridge authority. + - `localcast.diagnostics.audio_phase_field` can write `audio-phase-field-status.json` during replay so estimator behavior remains inspectable while the native ingest path is built. - `audio_field.active_probe` wires low phase-field confidence into `ActiveProbeOptimizer`, emits bounded chirplet WAVs plus `active-probes.jsonl`, and can play probes through the default output device. - - `scripts/stream_live_audio_field.py` is the live local capture owner for the deadline rig. It publishes `localcast.audio.mic_field` and `localcast.audio.phase_field` from visible local WASAPI/PortAudio mics plus Scarlett loopback, reports missing rig channels as explicit placeholders, plays confidence probes through the selected Scarlett output, and resamples probe playback when the output device runs at 44.1 kHz while the field timeline remains 48 kHz. + - `localcast.diagnostics.audio_live_field` preserves the old local WASAPI/PortAudio capture experiment as diagnostic code only. Production local mic and loopback ingest belongs in native capture workers that append typed handles through `LocalcastProducer`. - Active probe maintenance only targets source ids backed by live local capture devices. Missing distributed channels remain stable placeholders in the mic/phase field, but they do not consume chirp budget. - Active probe artifacts are bounded: emitted chirps rotate through a fixed slot set and the manifest rotates at a byte cap. The calibration loop is allowed to be noisy; it is not allowed to become an unbounded filesystem leak. - - `scripts/start-live-audio-phase-field.ps1` starts the live dense harmonic confidence loop with near-ultrasonic probes; `scripts/stop-live-audio-phase-field.ps1` stops the PID recorded in `logs/audio-phase-field.pid`. - Faust voice-separation boundary: - `localcast.audio.mic_field` publishes aligned six-mic float32 blocks at `calibration/runs/audio-mic-field.msgpack`. - `faust/localcast_voice_separation.dsp` is the first Aquarium-hosted graph surface for host voice, co-streamer voice, ambient, transient, and loopback stems. - - `scripts/start-live-faust-mic-field.ps1` starts the mic-field publisher for Aquarium/Faust. + - `localcast.diagnostics.faust_mic_field` can replay aligned WAV blocks into the old mic-field document for smoke tests. It is not a live publisher. ## Temporary @@ -107,6 +106,8 @@ shape removes independent per-kind storage from the live foundation. - The scripts assume Windows sender and OBS receiver on the same LAN. - The Python visual producer is a diagnostic/migration fossil only. The OpenGL Spout sink has been deleted. +- Python audio publishers are diagnostic fossils only. The live PowerShell + launchers for phase-field and Faust mic-field publication have been deleted. ## Next diff --git a/scripts/stream_live_audio_field.py b/localcast/diagnostics/audio_live_field.py similarity index 96% rename from scripts/stream_live_audio_field.py rename to localcast/diagnostics/audio_live_field.py index c3ab478..b977609 100644 --- a/scripts/stream_live_audio_field.py +++ b/localcast/diagnostics/audio_live_field.py @@ -8,7 +8,7 @@ import time import numpy as np -ROOT = Path(__file__).resolve().parents[1] +ROOT = Path(__file__).resolve().parents[2] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) @@ -22,27 +22,14 @@ from audio_field.cultcache_audio import ( # noqa: E402 ) from audio_field.phase_meaning import LivePhaseMeaningExtractor # noqa: E402 from audio_field.probe_optimizer import ActiveProbeOptimizer, ProbePolicy # noqa: E402 -from localcast.sensor_fusion import camera_sensor_id_for_microphone, phase_source_id_for_microphone # noqa: E402 - - -HOST_SOURCE_BY_MIC_ID = { - "mic_focusrite_local": "host-focusrite", - "mic_focusrite_neighbor": "co-streamer-focusrite", -} +from audio_field.profile import local_microphones, source_id_for_microphone # noqa: E402 +from localcast.sensor_fusion import camera_sensor_id_for_microphone # noqa: E402 def load_profile(path: Path) -> dict: return json.loads(Path(path).read_text(encoding="utf-8")) -def source_id_for_microphone(mic: dict) -> str | None: - return str(mic.get("phaseSourceId") or mic.get("sourceId") or HOST_SOURCE_BY_MIC_ID.get(str(mic.get("id", ""))) or phase_source_id_for_microphone(mic) or "") - - -def local_microphones(profile: dict, machine: str) -> list[dict]: - return [mic for mic in profile.get("microphones", []) if mic.get("machine") == machine and source_id_for_microphone(mic)] - - def summarize_device(device: dict) -> dict: return { "index": int(device["index"]), @@ -189,7 +176,7 @@ def play_probe_file(path: Path, *, device: int | None = None, output_rate: int | def main() -> None: - parser = argparse.ArgumentParser(description="Capture local live mics into Faust/phase CultCache fields.") + parser = argparse.ArgumentParser(description="Diagnostic replay of the old local mic capture experiment into CultCache fields.") parser.add_argument("--profile", type=Path, default=ROOT / "config" / "audio-field.json") parser.add_argument("--fallback-profile", type=Path, default=ROOT / "config" / "audio-field.example.json") parser.add_argument("--machine", default="local") diff --git a/scripts/stream_phase_field.py b/localcast/diagnostics/audio_phase_field.py similarity index 93% rename from scripts/stream_phase_field.py rename to localcast/diagnostics/audio_phase_field.py index c39d1a1..3bcddf0 100644 --- a/scripts/stream_phase_field.py +++ b/localcast/diagnostics/audio_phase_field.py @@ -7,13 +7,14 @@ import numpy as np from scipy.io import wavfile -ROOT = Path(__file__).resolve().parents[1] +ROOT = Path(__file__).resolve().parents[2] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) from audio_field.cultcache_audio import make_audio_phase_field, put_live_audio_phase_field # noqa: E402 from audio_field.active_probe import ActiveConfidenceMaintainer # noqa: E402 from audio_field.phase_meaning import LivePhaseMeaningExtractor # noqa: E402 +from audio_field.probe_bands import parse_probe_band, ultrasonic_probe_band # noqa: E402 from audio_field.probe_optimizer import ActiveProbeOptimizer, ProbePolicy # noqa: E402 @@ -110,7 +111,7 @@ def source_dicts(meaning) -> list[dict]: def main() -> None: - parser = argparse.ArgumentParser(description="Publish live extracted phase-field meaning from reference and aligned mic WAVs.") + parser = argparse.ArgumentParser(description="Diagnostic replay of extracted phase-field meaning from reference and aligned mic WAVs.") parser.add_argument("--field", type=Path, required=True, help="Aligned frames-by-channel mic field WAV.") parser.add_argument("--reference", type=Path, required=True, help="Known program/loopback reference WAV.") parser.add_argument("--cache", type=Path, default=ROOT / "calibration" / "runs" / "audio-phase-field.msgpack") @@ -244,22 +245,6 @@ def main() -> None: time.sleep(sleep_for) -def parse_probe_band(value: str) -> tuple[float, float]: - parts = value.split(":") - if len(parts) != 2: - raise SystemExit(f"probe band must be start:end Hz, got {value!r}") - return float(parts[0]), float(parts[1]) - - -def ultrasonic_probe_band(sample_rate: int) -> tuple[float, float]: - nyquist = 0.5 * float(sample_rate) - end_hz = min(22_000.0, nyquist - 1200.0) - start_hz = min(18_500.0, end_hz - 2500.0) - if end_hz <= 16_000.0 or start_hz <= 0.0: - raise SystemExit(f"sample rate {sample_rate} leaves no useful ultrasonic probe band") - return start_hz, end_hz - - def play_probe_file(path: Path) -> None: import sounddevice as sd diff --git a/scripts/stream_faust_mic_field.py b/localcast/diagnostics/faust_mic_field.py similarity index 95% rename from scripts/stream_faust_mic_field.py rename to localcast/diagnostics/faust_mic_field.py index e0d601b..551f72f 100644 --- a/scripts/stream_faust_mic_field.py +++ b/localcast/diagnostics/faust_mic_field.py @@ -7,7 +7,7 @@ import numpy as np from scipy.io import wavfile -ROOT = Path(__file__).resolve().parents[1] +ROOT = Path(__file__).resolve().parents[2] if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) @@ -48,7 +48,7 @@ def source_block(samples: np.ndarray, start_sample: int, frame_count: int, *, lo def main() -> None: - parser = argparse.ArgumentParser(description="Publish aligned mic channels as a Faust-ready voice-separation input field.") + parser = argparse.ArgumentParser(description="Diagnostic replay of aligned mic channels as a Faust-ready input field.") parser.add_argument("--input", type=Path, default=ROOT / "calibration" / "runs" / "audio-program-live-20260518-180226" / "field-program-cleaned.wav") parser.add_argument("--cache", type=Path, default=ROOT / "calibration" / "runs" / "audio-mic-field.msgpack") parser.add_argument("--graph-id", default="localcast.faust.voice_separation.v1") diff --git a/notes/current-system-map.md b/notes/current-system-map.md index 73cd24f..e1edf5a 100644 --- a/notes/current-system-map.md +++ b/notes/current-system-map.md @@ -100,7 +100,7 @@ flowchart TD K --> L["bounded field cache"] L --> M["aligned six-channel blocks"] M --> N["FOA encoder"] - M --> V["Faust mic-field publisher"] + M --> V["native mic-field producer"] V --> W["localcast.audio.mic_field"] W --> X["Aquarium Faust voice-separation graph"] N --> O["AmbiX ACN/SN3D bus: W,Y,Z,X"] @@ -113,7 +113,7 @@ Ownership: - `audio_field/` owns unit-testable buffering, bounded-latency convergence, injectable port protocols, and pipeline orchestration. - Runtime sync owns per-block chirplet observations from known speaker output and updates delay/SRO/phase estimates with confidence gates before alignment. - `audio_field.phase_meaning` owns extracting usable meaning from internal phase/chirplet evidence. The live cache publishes delay correction, coherence, confidence, distance-equivalent delta, reference-bleed/suppression estimates, correction energy, and active-probe need; raw phase bands stay inside the estimator. -- `scripts/stream_live_audio_field.py` is the current live local capture owner. It publishes `localcast.audio.mic_field` and `localcast.audio.phase_field` from the visible local Kiyo/PS Eye/Scarlett inputs, uses Scarlett loopback as the known reference, and keeps missing neighbor/Kiyo-right channels as explicit placeholders until synchronized feeds exist. +- `localcast.diagnostics.audio_live_field`, `localcast.diagnostics.audio_phase_field`, and `localcast.diagnostics.faust_mic_field` preserve the old Python audio publisher experiments as diagnostics only. Production mic, loopback, and phase ingest belongs in native capture workers that append typed sample handles through `LocalcastProducer`. - `audio-phase-field-status.json` declares the phase runtime mode. Current deadline mode is `live-local-capture` with closed-loop probe capture when Scarlett loopback is available. - Active probe optimization owns extra chirplet emission when confidence drops, bounded by level/spacing/audibility budget. `audio_field.active_probe` is the runtime join that converts phase-field confidence into emitted chirplet WAVs/manifests and playback. Probe WAVs rotate through fixed slots and the manifest rotates at a byte cap; calibration may be dense, but artifacts must stay bounded. - The camera/sensor-fusion pipeline may publish world poses later; it does not own audio clocks or channel timing. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 3c8fd1d..e913616 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -46,6 +46,11 @@ Get-Content .\state\evidence.jsonl -Tail 8 - Python live producers and diagnostic CultCache/JSON file adapters are diagnostics, not production foundations. The OpenGL Spout sink has been deleted. Aquarium owns production Spout publication. +- Python audio phase/live/Faust publishers have been moved under + `localcast.diagnostics.*`, their live PowerShell launchers have been deleted, + and reusable mic-profile/probe-band helpers now live in `audio_field`. + Production audio ingest must use native capture workers and + `LocalcastProducer`. - Neighbor sender is deployed at `C:\Meta\LocalCastBridge` on `192.168.1.84`. - Madman's desktop has `Start LocalCast Sender.cmd` and `Stop LocalCast Sender.cmd`. - Receiver OBS scene collection has `Neighbor PC - Video`, `Neighbor PC - Focusrite`, and `Neighbor PC - System Audio` Media Sources added. @@ -59,6 +64,8 @@ Get-Content .\state\evidence.jsonl -Tail 8 The useful next work is foundation surgery, not hardware feature expansion: - bind Aquarium/Faust/native workers to the rolling-buffer `LocalcastRuntime` +- build native mic/loopback/phase producers over `LocalcastProducer`; do not + restore Python audio live launchers - delete production dependence on `localcast.diagnostics.visual_producer` and diagnostic file adapters - bind Aquarium/Faust against the native runtime/producer ABI instead of diff --git a/scripts/start-live-audio-phase-field.ps1 b/scripts/start-live-audio-phase-field.ps1 deleted file mode 100644 index 669c123..0000000 --- a/scripts/start-live-audio-phase-field.ps1 +++ /dev/null @@ -1,66 +0,0 @@ -param( - [string]$Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path, - [string]$Python = ".\.venv\Scripts\python.exe", - [string]$Field = ".\calibration\runs\audio-program-live-20260518-180226\field-program-cleaned.wav", - [string]$Reference = ".\calibration\runs\audio-program-live-20260518-180226\ground_truth_loopback.wav", - [string]$Cache = ".\calibration\runs\audio-phase-field.msgpack", - [string]$ProbeDir = ".\calibration\runs\active-probes", - [double]$TargetConfidence = 0.72, - [double]$TriggerConfidence = 0.45, - [int]$MinProbeIntervalFrames = 1, - [double]$ProbeLevelDbfs = -24.0, - [double]$ProbeSeconds = 0.08, - [double]$HarmonicRootHz = 440.0, - [int]$HarmonicVoices = 48, - [switch]$NoPlayback -) - -$ErrorActionPreference = "Stop" - -Set-Location -LiteralPath $Root - -$logDir = Join-Path $Root "logs" -New-Item -ItemType Directory -Force -Path $logDir | Out-Null - -$resolvedPython = if ([System.IO.Path]::IsPathRooted($Python)) { $Python } else { Join-Path $Root $Python } -$stdout = Join-Path $logDir "audio-phase-field.stdout.log" -$stderr = Join-Path $logDir "audio-phase-field.stderr.log" -$pidPath = Join-Path $logDir "audio-phase-field.pid" - -$arguments = @( - ".\scripts\stream_phase_field.py", - "--field", $Field, - "--reference", $Reference, - "--cache", $Cache, - "--source-id", "host-focusrite", - "--source-id", "co-streamer-focusrite", - "--source-id", "kiyo-0", - "--source-id", "kiyo-1", - "--source-id", "ps-eye-0", - "--source-id", "ps-eye-1", - "--loop", - "--realtime", - "--maintain-confidence", - "--cram-harmonic-probes", - "--probe-output-dir", $ProbeDir, - "--probe-unmasked", - "--target-confidence", ([string]$TargetConfidence), - "--trigger-confidence", ([string]$TriggerConfidence), - "--min-probe-interval-frames", ([string]$MinProbeIntervalFrames), - "--probe-level-dbfs", ([string]$ProbeLevelDbfs), - "--probe-seconds", ([string]$ProbeSeconds), - "--harmonic-root-hz", ([string]$HarmonicRootHz), - "--harmonic-voices", ([string]$HarmonicVoices) -) - -if (-not $NoPlayback) { - $arguments += "--play-probes" -} - -$process = Start-Process -FilePath $resolvedPython -ArgumentList $arguments -RedirectStandardOutput $stdout -RedirectStandardError $stderr -PassThru -WindowStyle Hidden -Set-Content -Path $pidPath -Value ([string]$process.Id) -Encoding ASCII - -Write-Host "Started live audio phase-field confidence loop PID $($process.Id)" -Write-Host "stdout: $stdout" -Write-Host "stderr: $stderr" -Write-Host "pid: $pidPath" diff --git a/scripts/start-live-faust-mic-field.ps1 b/scripts/start-live-faust-mic-field.ps1 deleted file mode 100644 index 99c3791..0000000 --- a/scripts/start-live-faust-mic-field.ps1 +++ /dev/null @@ -1,35 +0,0 @@ -param( - [string]$Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path, - [string]$Python = ".\.venv\Scripts\python.exe", - [string]$InputPath = ".\calibration\runs\audio-program-live-20260518-180226\field-program-cleaned.wav", - [string]$Cache = ".\calibration\runs\audio-mic-field.msgpack" -) - -$ErrorActionPreference = "Stop" - -Set-Location -LiteralPath $Root - -$logDir = Join-Path $Root "logs" -New-Item -ItemType Directory -Force -Path $logDir | Out-Null - -$resolvedPython = if ([System.IO.Path]::IsPathRooted($Python)) { $Python } else { Join-Path $Root $Python } -$stdout = Join-Path $logDir "faust-mic-field.stdout.log" -$stderr = Join-Path $logDir "faust-mic-field.stderr.log" -$pidPath = Join-Path $logDir "faust-mic-field.pid" - -$arguments = @( - ".\scripts\stream_faust_mic_field.py", - "--input", $InputPath, - "--cache", $Cache, - "--loop", - "--realtime", - "--smoke-readback" -) - -$process = Start-Process -FilePath $resolvedPython -ArgumentList $arguments -RedirectStandardOutput $stdout -RedirectStandardError $stderr -PassThru -WindowStyle Hidden -Set-Content -Path $pidPath -Value ([string]$process.Id) -Encoding ASCII - -Write-Host "Started live Faust mic-field publisher PID $($process.Id)" -Write-Host "stdout: $stdout" -Write-Host "stderr: $stderr" -Write-Host "pid: $pidPath" diff --git a/scripts/stop-live-audio-phase-field.ps1 b/scripts/stop-live-audio-phase-field.ps1 deleted file mode 100644 index 8fa5925..0000000 --- a/scripts/stop-live-audio-phase-field.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -param( - [string]$Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path -) - -$ErrorActionPreference = "Stop" - -Set-Location -LiteralPath $Root - -$pidPath = Join-Path $Root "logs\audio-phase-field.pid" -if (-not (Test-Path -LiteralPath $pidPath)) { - Write-Host "No live audio phase-field PID file found." - exit 0 -} - -$pidText = (Get-Content -LiteralPath $pidPath -Raw).Trim() -if ($pidText.Length -eq 0) { - Remove-Item -LiteralPath $pidPath -Force - Write-Host "Empty PID file removed." - exit 0 -} - -$process = Get-Process -Id ([int]$pidText) -ErrorAction SilentlyContinue -if ($null -ne $process) { - Stop-Process -Id $process.Id -Force - Write-Host "Stopped live audio phase-field PID $($process.Id)" -} else { - Write-Host "Live audio phase-field PID $pidText is not running." -} - -Remove-Item -LiteralPath $pidPath -Force diff --git a/scripts/stop-live-faust-mic-field.ps1 b/scripts/stop-live-faust-mic-field.ps1 deleted file mode 100644 index af94f6b..0000000 --- a/scripts/stop-live-faust-mic-field.ps1 +++ /dev/null @@ -1,30 +0,0 @@ -param( - [string]$Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path -) - -$ErrorActionPreference = "Stop" - -Set-Location -LiteralPath $Root - -$pidPath = Join-Path $Root "logs\faust-mic-field.pid" -if (-not (Test-Path -LiteralPath $pidPath)) { - Write-Host "No live Faust mic-field PID file found." - exit 0 -} - -$pidText = (Get-Content -LiteralPath $pidPath -Raw).Trim() -if ($pidText.Length -eq 0) { - Remove-Item -LiteralPath $pidPath -Force - Write-Host "Empty PID file removed." - exit 0 -} - -$process = Get-Process -Id ([int]$pidText) -ErrorAction SilentlyContinue -if ($null -ne $process) { - Stop-Process -Id $process.Id -Force - Write-Host "Stopped live Faust mic-field PID $($process.Id)" -} else { - Write-Host "Live Faust mic-field PID $pidText is not running." -} - -Remove-Item -LiteralPath $pidPath -Force diff --git a/state/evidence.jsonl b/state/evidence.jsonl index ecdf33f..1d02423 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -70,3 +70,4 @@ {"ts": "2026-05-19T11:40:00+01:00", "type": "implementation", "status": "ok", "note": "Aquarium-Engine now has a safe-code LocalCast native reservoir binding layer committed as 4d5aec7. It mirrors LocalcastSampleKind, LocalcastSampleHandle, LocalcastRuntimeStatus, and exposes mockable runtime/producer interfaces plus DllImport wrappers; Aquarium.LocalCast.Tests passed 10 tests."} {"ts": "2026-05-19T11:55:00+01:00", "type": "implementation", "status": "ok", "note": "Aquarium-Engine LocalCastRuntime now consumes an injected ILocalCastVisualFrameSource instead of directly owning LocalCastVisualStateReader. Commit 8798908 adds the source seam and tests; Aquarium.LocalCast.Tests passed 11 tests and the branch was pushed."} {"ts": "2026-05-19T12:08:00+01:00", "type": "implementation", "status": "ok", "note": "Aquarium-Engine commit 687845c adds LocalCastNativeVisualFrameSource over ILocalCastNativeRuntime. It reads the latest live render-packet handle from the native runtime and uses an injected payload decoder to produce LocalCastVisualFrame, keeping reservoir traversal separate from payload ownership; Aquarium.LocalCast.Tests passed 13 tests and the branch was pushed."} +{"ts": "2026-05-19T09:57:12+00:00", "type": "implementation", "status": "ok", "note": "Python audio live launchers removed: phase/live/Faust publisher scripts moved under localcast.diagnostics, reusable mic profile and probe-band helpers moved into audio_field, and docs/state now name native LocalcastProducer capture workers as the production audio ingest owner."} diff --git a/state/map.yaml b/state/map.yaml index 2a66280..4bd47e5 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -168,20 +168,12 @@ research: weights, correction energy, and active-probe need. `audio_field.active_probe` closes the next loop by feeding that confidence state into ActiveProbeOptimizer and emitting bounded chirplet WAVs/manifests, with - optional playback. The live launcher now uses dense harmonic - near-ultrasonic probe textures so aliases have a musical relationship - instead of arbitrary squeal. Probe artifacts rotate through fixed slots - and the manifest rotates at a byte cap. `scripts/stream_live_audio_field.py` - is the current live local capture owner: it writes mic-field and - phase-field CultCache documents from visible local mics plus Scarlett - loopback, sends probes through the selected Scarlett output, resamples - probe playback when that output is 44.1 kHz, and reports missing - distributed channels as explicit placeholders. Active probe scheduling is - restricted to source ids with live local capture devices, so placeholders - do not consume chirp budget. `audio-phase-field-status.json` - declares input mode and whether active probes are closed-loop; current - deadline mode is `live-local-capture` with closed-loop probe capture when - Scarlett loopback is available. + optional playback. Probe artifacts rotate through fixed slots and the + manifest rotates at a byte cap. The old Python phase/live/Faust audio + publishers now live under `localcast.diagnostics.*` and are diagnostic + replay or experiment paths only. Production mic, loopback, and phase + ingest belongs in native capture workers that append typed sample handles + through `LocalcastProducer`. This is learned audio-field state, not a phase display. faust_voice_separation: summary: docs/aquarium-spatial-audio.md diff --git a/tests/test_active_probe.py b/tests/test_active_probe.py index dcd019f..76a95af 100644 --- a/tests/test_active_probe.py +++ b/tests/test_active_probe.py @@ -7,7 +7,7 @@ import numpy as np from audio_field.active_probe import ActiveConfidenceMaintainer, harmonic_frequencies, is_masked_window, make_harmonic_probe_texture, make_probe_chirplet from audio_field.phase_meaning import PhaseFieldMeaning, SourcePhaseMeaning from audio_field.probe_optimizer import ActiveProbeOptimizer, ProbePolicy -from scripts.stream_phase_field import ultrasonic_probe_band +from audio_field.probe_bands import ultrasonic_probe_band class ActiveProbeTests(unittest.TestCase): diff --git a/tests/test_spatial_audio_cultcache.py b/tests/test_spatial_audio_cultcache.py index c4adb9d..1a1132e 100644 --- a/tests/test_spatial_audio_cultcache.py +++ b/tests/test_spatial_audio_cultcache.py @@ -21,7 +21,7 @@ from audio_field.cultcache_audio import ( put_live_mic_field_frame, put_live_spatial_audio_frame, ) -from scripts.stream_live_audio_field import local_microphones, source_id_for_microphone +from audio_field.profile import local_microphones, source_id_for_microphone class SpatialAudioCultCacheTests(unittest.TestCase):