From ee8b878b6c4df4ae3296b1049f16a02362392c68 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 19 May 2026 08:40:30 +0100 Subject: [PATCH] Record native reservoir rebuild cut line --- docs/implementation-plan.md | 59 ++++++++++--- docs/native-rebuild-plan.md | 147 +++++++++++++++++++++++++++++++ notes/current-system-map.md | 80 +++++++++-------- notes/fresh-workspace-handoff.md | 24 ++--- state/evidence.jsonl | 11 +++ state/map.yaml | 82 +++++++++-------- 6 files changed, 297 insertions(+), 106 deletions(-) create mode 100644 docs/native-rebuild-plan.md diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 7033305..04e429a 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -1,13 +1,36 @@ # Implementation Plan +## Current Cut Line + +`docs/native-rebuild-plan.md` is now the active plan. + +No more Python live hot path. No more OpenGL production Spout sink. No more JSON +live data stores. Edge JSON may define CultNet schema or export diagnostics, but +the real process/network data stays typed because every subsystem is under our +control. + +The native reservoir must become one time-ordered rolling buffer with typed +indexes/views. The current shared-edge typed rings proved the retention +invariant, but independent rings are still too much duplicated structure for the +live foundation. + ## Implemented - Perfect Machine contract: - `docs/perfect-machine.md` defines the target native machine: one five-second spatiotemporal reservoir, Aquarium-owned dense visual fusion/material/brush rendering, Faust-owned hot audio DSP, OBS-owned broadcast controls, and LocalCastBridge-owned calibration/config/status. - `config/perfect-machine.example.json` declares the contract shape for six cameras, six microphones, reservoir rings, native authorities, outputs, and the demotion of bridge scripts to tooling. - - `native/reservoir` is the first native Rust crate. It implements shared-edge five-second reservoir rings and proves that all rings expire against the newest sample, not private per-source clocks. - - `native/reservoir/include/localcast_reservoir.h` exposes the Aquarium/Faust C ABI: opaque reservoir create/destroy, sample-handle push, edge/window queries, ring counts, and latest sample lookup by sensor hash. Payload memory remains owned by Aquarium/GPU/Faust; the reservoir owns timing and retention. - - `LocalcastRuntime` now wraps the reservoir with typed native producer calls for camera frames/features, scene rays, surface/material claims, audio blocks, phase claims, events, and render packets. It also exposes native status with shared edge/window and ring counts, replacing the Python file-cache path as the intended live spine. + - `native/reservoir` is the first native Rust crate. It currently implements + shared-edge five-second typed rings and proves that every kind expires from + the newest live sample. That proof survives; the structure does not get a + pardon. The next foundation is one rolling buffer plus typed indexes/views. + - `native/reservoir/include/localcast_reservoir.h` exposes the initial + Aquarium/Faust C ABI: opaque reservoir create/destroy, sample-handle push, + edge/window queries, ring counts, and latest sample lookup by sensor hash. + This ABI should be revised around the rolling-buffer model before + Aquarium/Faust bind to it. + - `LocalcastRuntime` wraps the current reservoir with typed native producer + calls. It is the intended live spine, but must be rebuilt on the single + rolling-buffer invariant before new runtime work. - Repo-local persistence machinery. - First architecture map. - Example config for one video source plus two audio sources. @@ -74,17 +97,25 @@ - Audio defaults to AAC inside MPEG-TS for compatibility; test Opus later only if there is a concrete reason. - Desktop capture uses `gdigrab` first because it is broadly available. `ddagrab` is a candidate once the installed FFmpeg build is confirmed. - The scripts assume Windows sender and OBS receiver on the same LAN. -- The Python live producers/renderers are compatibility diagnostics. They are no longer the intended runtime API. +- The Python live producers/renderers and OpenGL Spout sink are diagnostics or + migration fossils only. They should be quarantined or deleted early instead + of adapted. ## Next -1. Add the Aquarium-side binding that loads `localcast_reservoir`, creates `LocalcastRuntime`, and maps GPU/audio buffer handles to `LocalcastSampleHandle`. -2. Move camera ingest into native capture workers that call `localcast_runtime_push_camera_frame`. -3. Move mic/loopback ingest into native capture workers that call `localcast_runtime_push_audio_block`. -4. Move feature extraction, flow, cross-view matching, LOD reconciliation, and material fitting into Aquarium GPU compute. -5. Move mic alignment, voice separation, room suppression, Ambisonic/HOA spatialization, and stem generation into Faust/native DSP. -6. Replace the deadline Spout sink with Aquarium-owned Spout publication from the native render target. -7. Feed the neighbor Focusrite shotgun and neighbor loopback into the reservoir as live synchronized audio inputs. -8. Replace placeholder mic/speaker/camera geometry with measured `config/audio-field.json` and `config/sensor-fusion.json` coordinates. -9. Calibrate Leap as a geometric camera so Leap contributes direct 3D rays, not only timing evidence. -10. Keep the Python bridge only for calibration, contract tests, device discovery, status, and offline analysis. +1. Rewrite `native/reservoir` as one rolling buffer with typed indexes/views. +2. Update ABI/tests so single-edge expiry, typed view queries, latest lookup, + and diagnostic/fallback exclusion are enforced by construction. +3. Quarantine or delete production use of `scripts/live_sensor_fusion.py`, + `localcast.sensor_fusion.spout_output`, JSON render-frame stores, JSON LOD + stores, and Python reservoir-window clipping. +4. Bind Aquarium/Faust to the rebuilt `LocalcastRuntime`. +5. Move camera/mic/loopback ingest into native capture workers that append + typed sample handles. +6. Move feature extraction, flow, cross-view matching, LOD reconciliation, + material fitting, brush/splat rendering, and Spout2 publication into + Aquarium GPU compute. +7. Move mic alignment, room suppression, voice separation, Ambisonic/HOA + spatialization, and stem generation into Faust/native DSP. +8. Keep FFmpeg/SRT scripts as simple LAN ingest/capture utilities, not the + synchronized program authority. diff --git a/docs/native-rebuild-plan.md b/docs/native-rebuild-plan.md new file mode 100644 index 0000000..2ea3a69 --- /dev/null +++ b/docs/native-rebuild-plan.md @@ -0,0 +1,147 @@ +# Native Rebuild Plan + +This is the cut line after the architectural teardown. + +The live system must be rebuilt around one native rolling reservoir. Python and +OpenGL are no longer acceptable live foundations. They may remain as offline +calibration, schema tests, device discovery, migration probes, and forensic +tools only. If a future change needs Python or the current OpenGL Spout sink in +the live path, treat that as evidence the native boundary is missing, not as +permission to extend the deadline bridge. + +## Objective + +Make the second PC available in OBS as synchronized program video plus +separately controllable audio while preserving the real ownership model: + +- LocalCastBridge owns config, calibration, contract tests, launch, status, and + CultNet schema. +- One native runtime owns live sample timing and retention. +- Aquarium owns GPU visual fusion, material/brush/splat rendering, and Spout2 + publication. +- Faust/native DSP owns hot audio alignment, suppression, voice separation, + stems, and spatial bed generation. +- OBS owns broadcast controls. + +## Durable State Model + +Durable state is declarative or evidentiary. It is not the live machine. + +- `config/localcast.json`: LAN sender/receiver endpoints, OBS source names, and + FFmpeg/NVENC settings for simple bridge mode. +- `config/sensor-fusion.json`: measured camera identity, intrinsics, extrinsics, + capture hints, and calibration timestamps. +- `config/audio-field.json`: measured mic/speaker identity, geometry, clock + domains, channel order, roles, gain, delay, and polarity. +- CultNet schema JSON: edge schema only. The actual runtime documents are typed + CultNet documents, not JSON data files. +- Calibration artifacts: WAVs, images, manifests, solves, and evidence ledgers. +- `state/*` and `notes/*`: rehydration memory for agents, never runtime truth. + +## Runtime State Model + +The runtime state is one native rolling buffer with a single edge. + +```mermaid +flowchart TD + C["native capture workers"] --> R["LocalcastRuntime rolling reservoir"] + A["audio capture / loopback workers"] --> R + R --> Q["Aquarium GPU fusion + render"] + R --> F["Faust/native DSP"] + Q --> S["Spout2 sender"] + F --> P["program stems + spatial bed"] + S --> O["OBS"] + P --> O + R --> N["typed CultNet status/docs"] +``` + +The reservoir stores sample handles in one time-ordered rolling buffer. Each +sample has: + +- kind: camera frame, camera feature, scene ray, surface claim, material claim, + audio block, phase claim, event claim, render packet, or status claim +- source id +- source timestamp +- arrival timestamp +- sequence +- payload handle + +Typed ring views may exist as indexes over the rolling buffer, but they do not +own retention. Expiry happens once, against the reservoir edge. No private +history outlives the rolling buffer. + +Payload memory belongs to the producing domain. Aquarium owns GPU image, +feature, surface, material, and render payloads. Faust/native DSP owns audio +buffers and stem payloads. The reservoir owns timing, identity, ordering, +retention, and handle lookup. + +## Authoritative Boundaries + +- Config/calibration crosses into runtime as immutable measured truth plus + explicit profile version. +- Capture workers cross into runtime by appending typed sample handles. +- Aquarium crosses the reservoir boundary by sampling typed visual/audio timing + handles and publishing a Spout2 texture. +- Faust/native DSP crosses the reservoir boundary by sampling audio/phase/event + handles and publishing typed stem/spatial-bed documents or OBS-facing audio + surfaces. +- CultNet carries typed process/network documents for status, control, and + external consumers. JSON exists only to declare schema or export diagnostics. +- OBS receives final program surfaces. It does not own synchronization or scene + reconstruction. + +## Derived, Not Stored + +- Render packets are derived from reservoir claims. +- LOD cells are derived from current reservoir contents. +- Brush/splat packets are derived by Aquarium. +- Audio event overlays are derived from event claims and presentation time. +- Point budgets are derived from typed claim metadata, not string prefixes. +- JSON heartbeat/status files are diagnostic exports only, if they survive at + all. + +## Delete Early + +Delete or quarantine these before adding new live features: + +- Python live producers. +- Python live audio/visual hot loops. +- OpenGL Spout renderer. +- Synthetic/fallback visual evidence in the production path. +- JSON render-frame and LOD stores as live data. +- Renderer-owned semantic priority based on stable-key prefixes. +- Multiple Python copies of reservoir-window clipping. +- File mtime caches used as lifecycle or data freshness authority. + +## Impossible By Construction + +- A sample older than the reservoir window is visible to live consumers. +- A diagnostic/fallback source enters a ground-truth reservoir kind. +- A renderer invents scene priority from display names or string prefixes. +- JSON becomes live data transport. +- Python becomes the production hot path. +- OpenGL becomes the production Spout sink. +- OBS broadcasts raw unsynchronized sources as the synchronized program. +- Two modules own the reservoir edge. + +## Migration Order + +1. Freeze this plan in persistence and stop feature work on the Python/OpenGL + bridge. +2. Rewrite `native/reservoir` from typed independent rings to one rolling buffer + with typed indexes/views. +3. Add contract tests proving single-edge expiry, typed view queries, latest + lookup, and impossible fallback admission. +4. Add the minimal Aquarium/Faust C ABI over the rolling buffer. +5. Move any remaining useful Python packet/schema code into diagnostics or + contract tests. +6. Remove production imports of `scripts/live_sensor_fusion.py` and + `localcast.sensor_fusion.spout_output`. +7. Replace the OpenGL Spout path with an Aquarium-owned Spout publisher. +8. Move audio hot path into Faust/native DSP behind typed reservoir handles. +9. Keep FFmpeg/SRT scripts only as simple V1 LAN bridge and capture utilities. +10. Delete dead compatibility files once no diagnostic command depends on them. + +Small commits are allowed. Small evasions are not. If a commit preserves the +deadline bridge by adding an adapter around it, it is probably feeding the old +machine again. diff --git a/notes/current-system-map.md b/notes/current-system-map.md index b1800c9..3ca35b7 100644 --- a/notes/current-system-map.md +++ b/notes/current-system-map.md @@ -1,17 +1,18 @@ # Current System Map LocalCastBridge is intentionally thin. The target live machine is not the -deadline bridge; it is the native reservoir described in -`docs/perfect-machine.md` and `config/perfect-machine.example.json`. +deadline bridge; it is the native rolling reservoir described in +`docs/native-rebuild-plan.md`, `docs/perfect-machine.md`, and +`config/perfect-machine.example.json`. ## Perfect Machine Target ```mermaid flowchart TD - A["6 cameras"] --> R["5s native reservoir"] - B["6 microphones"] --> R - C["Leap timing/IR"] --> R - D["loopback + remote video/audio"] --> R + A["native camera workers"] --> R["single 5s rolling reservoir"] + B["native mic/loopback workers"] --> R + C["Leap timing/IR workers"] --> R + D["remote video/audio workers"] --> R R --> E["Aquarium GPU fusion + material field"] R --> F["Faust DSP"] E --> G["Spout2 texture"] @@ -26,10 +27,21 @@ Ownership: - Aquarium owns dense visual fusion, material/brush/splat reconciliation, final render target, and Spout publication. - Faust owns hot audio DSP and program stem generation. - OBS owns broadcast controls. -- Python remains tooling, not the stream hot path. -- `native/reservoir` is the first native crate. It owns shared-edge five-second sample retention for typed rings and exposes the C ABI in `native/reservoir/include/localcast_reservoir.h`: opaque reservoir lifetime, sample-handle push, edge/window queries, ring counts, latest-by-sensor lookup, and the `LocalcastRuntime` spine for typed producer appends plus native status. +- Python remains tooling only: calibration, contract tests, device discovery, + offline analysis, and diagnostics. It is not the stream hot path. +- OpenGL is not the production Spout sink. Aquarium owns production Spout2 + publication. +- `native/reservoir` is the first native crate. Its current shared-edge typed + rings proved the retention invariant, but the target is one time-ordered + rolling buffer with typed indexes/views. Retention has one owner. -Invariant: the five-second spatiotemporal reservoir is the live authority. Producers append sample handles through typed native calls, optimizers refine, Aquarium/Faust sample and interpret the pointed-to payloads. No private history outlives the reservoir, and the reservoir does not pretend to own GPU image memory or Faust audio buffers. Python scripts are compatibility diagnostics and calibration tools, not the live API. +Invariant: the five-second spatiotemporal reservoir is the live authority. +Producers append sample handles through typed native calls, optimizers refine, +Aquarium/Faust sample and interpret the pointed-to payloads. No private history +outlives the reservoir, and typed views do not own retention. The reservoir does +not pretend to own GPU image memory or Faust audio buffers. Edge JSON may +declare schema or export diagnostics; live process/network data is typed +CultNet documents. ```mermaid flowchart TD @@ -111,43 +123,35 @@ Ownership: Invariant: distributed camera/Focusrite microphones must be aligned and resampled into one reference timeline before FOA encoding. Latency is allowed as bounded buffering, but cache depth must converge toward real-time. Speaker output chirplets are live telemetry; delay/SRO/phase state must update during runtime, not only during setup. Extra chirplets may be emitted automatically when confidence drops, but only under the active probe optimizer's budget. The local shielded cardioid and neighbor shotgun are the high-quality dialogue anchors; camera mics provide spatial/context evidence. -## Visual Fusion Sidecar +## Visual Fusion Cut Line ```mermaid flowchart TD - A["synthetic/live observations"] --> B["SensorRig.fuse"] - B --> C["RenderFramePacket"] - C --> D["CultCache visual-state.msgpack"] - D --> E["stream_spout.py"] - E --> F["ScreenBrushPacket lowering"] - F --> G["Spout sender"] - G --> H["OBS Spout2 Capture"] - I["Leap motion evidence"] --> J["multi-LOD scene cache"] - K["RGB/stochastic/synthetic evidence"] --> J - M["live clap audio transient"] --> N["Leap-timed clap calibration"] - O["Kiyo stereo motion window"] --> N - N --> C - N --> J - J --> L["Aquarium compute reconciliation"] + A["native camera/Leap sample handles"] --> R["rolling reservoir"] + B["audio/phase/event handles"] --> R + R --> C["Aquarium GPU feature/fusion/material/brush"] + C --> D["Aquarium Spout2 sender"] + R --> E["typed CultNet status/docs"] + D --> F["OBS Spout2 Capture"] ``` Ownership: -- `localcast.sensor_fusion.cultcache_docs` owns typed visual state documents. -- `scripts/live_sensor_fusion.py` currently owns the live producer and writes `localcast.visual.render_frame` into CultCache. -- The live producer now keeps a rolling RGB/Leap frame window for clap calibration. Kiyo stereo motion gives the first rough 3D clap position; Leap participates as the high-precision visual timing witness until a calibrated Leap geometric model joins the rig. -- Clap peaks update a per-camera clock sync model. Camera history sampling uses `oracle_time - camera_offset`, so the point builder can reconstruct a shared instant instead of mixing latest frames from different clock domains. -- The live producer's temporal authority is a five-second spatiotemporal reservoir measured backward from the newest shared sample. RGB/Leap history expires against that shared edge, LOD evidence is clipped to the same window, and each render frame declares the exact reservoir slice with `source_time_min_ns` and `source_time_max_ns`. -- Multi-LOD cache cells carry first-pass material evidence: weighted albedo plus roughness/metallic hints. Aquarium owns the real relighting/BRDF refinement, but it should receive material state from the reservoir rather than reverse-engineering it from screen brushes. -- `stream_spout.py` clamps stale visual packets to the current audio reservoir edge before OBS sees them. If a camera path blocks past the five-second window, its stale points are dropped. Current live deadline mode uses `--rgb-fallback-only --leap-fallback-only` because direct OpenCV camera reads measured slower than the reservoir; the next cut is nonblocking camera ingress that fills the reservoir continuously. -- `LatestFramePump` now runs blocking OpenCV camera sources off the producer hot loop. Deadline live mode keeps per-frame visual density low enough for TAA/reservoir accumulation: roughly 1.6k Spout points at `audio_delta_ns: 0` with `--rgb-room-step 16 --leap-step 16 --points 64`. -- `localcast.sensor_fusion.chirp_pose` now turns phase-field delay meaning for Kiyo/PS Eye microphone sources into camera-body range constraints and per-camera pose-correction estimates. It loads camera-mic and speaker geometry from the audio-field profile when available, falling back to the example profile/defaults. The live producer publishes those constraints as `camera-chirp:*` and `camera-pose-correction:*` render points plus `chirp-camera-pose` LOD evidence. Audio range/timing evidence augments visual calibration; it does not own image geometry. -- The Spout point-budget policy pins calibration and cross-modal constraints before spending the remaining adaptive LOD budget on stable high-priority surface claims and frame-rotated samples. Its JSON heartbeat reports the prefix counts that survived the render budget. -- The live producer also writes a multi-LOD scene cache with source kind and priority. Real Leap frames are the highest-priority timing/spatial evidence; Leap fallback frames are tagged as fallback and do not become ground truth. -- `scripts/stream_spout.py` consumes typed CultCache state and publishes Spout. Its presentation camera defaults to `kiyo-mid-deru`: the virtual eye sits halfway between the two Kiyo-class cameras and aims at the co-streamer body target. Its render budget is temporal: high-confidence anchors stay stable while the remaining samples rotate by frame id for TAA/supersampling reconciliation. -- CultNet document replication is the intended API boundary for other producers/consumers. +- Native capture workers own device reads and append handles. They do not own + scene reconstruction. +- The rolling reservoir owns the live edge, retention, ordering, and typed + lookup. +- Aquarium owns dense visual fusion, material fitting, point/brush/splat + lowering, render budgeting, and Spout2 publication. +- CultNet typed documents carry status/control/process state. JSON is schema or + diagnostic export only. +- `scripts/live_sensor_fusion.py`, Python fallback producers, JSON LOD stores, + and `localcast.sensor_fusion.spout_output` are diagnostics/migration fossils. + They must not be extended as production surfaces. -Invariant: JSON is not the visual-state authority. The current renderer can still write a JSON heartbeat for human inspection, but live visual state lives in typed CultCache MessagePack documents. Leap outranks camera surfaces only when the frame source is actual Leap capture; diagnostics must stay labeled as diagnostics. The reservoir horizon is five seconds; producers may fill gaps as late samples arrive inside that window, but they may not silently preserve older evidence in the live fusion cache. +Invariant: fallback/demo evidence cannot enter ground-truth reservoir kinds. +Render packets, LOD cells, brush packets, and overlays are derived from reservoir +claims. The renderer cannot invent scene priority from string prefixes. ## OBS Program Surface diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index b54b4e5..16c7f08 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -22,10 +22,11 @@ Get-Content .\state\evidence.jsonl -Tail 8 - V1 uses FFmpeg plus OBS Media Source over SRT. - Sender-side video encoding is `h264_nvenc`. - Audio sources are separate SRT endpoints so OBS can mix them separately. -- The repo contains scripts and docs, not a native OBS plugin. -- Visual fusion now has a deadline Spout sender: `scripts/stream_spout.py` consumes `RenderFramePacket` JSON, renders points into an OpenGL FBO, and publishes the Spout sender `LocalCastBridge Point Cloud` for OBS. -- The detached sender status file is `calibration/runs/stream-spout-status.json`; logs are `calibration/runs/stream-spout.log` and `calibration/runs/stream-spout.err.log`. -- Aquarium remains the intended dense splat/brush renderer behind the same `RenderFramePacket` boundary. Do not let the OpenGL sink become scene authority. +- The live synchronized program path is being rebuilt. The Python/OpenGL deadline Spout bridge is not a foundation. +- `docs/native-rebuild-plan.md` is the current cut plan. +- The reservoir target is one native time-ordered rolling buffer with typed indexes/views. The current typed-ring crate proved the expiry invariant but should be rewritten before new live features. +- Edge JSON is schema/diagnostic only. Runtime network/process data should remain typed CultNet documents. +- Python live producers and the OpenGL Spout sink should be deleted or quarantined as diagnostics before the next feature pass. Aquarium owns production Spout publication. - 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. @@ -36,15 +37,14 @@ Get-Content .\state\evidence.jsonl -Tail 8 ## Current Pressure -The useful next work is real hardware validation: +The useful next work is foundation surgery, not hardware feature expansion: -- in OBS, add/select a Spout2 Capture source named `LocalCastBridge Point Cloud` -- replace demo packets by writing live fusion packets to `calibration/runs/live-render-frame.json` -- move the packet consumer into Aquarium Engine once the stream survives deadline pressure -- open OBS and smoke-test the three configured receiver sources from Madman's desktop launcher -- tune latency once streams are live in OBS -- add a real loopback/virtual audio capture source if system-output audio is required +- rewrite `native/reservoir` as one rolling buffer with typed indexes/views +- update ABI and tests around single-edge retention +- quarantine or delete production use of `scripts/live_sensor_fusion.py` and the OpenGL `spout_output` sink +- route future visual/audio runtime work through Aquarium/Faust/native runtime plus typed CultNet docs +- keep FFmpeg/SRT bridge scripts only as simple LAN ingest and capture utilities ## Immediate Re-entry Instruction -Do not continue implementation automatically from a rehydrate-only request. Rehydrate, then follow the user's next instruction. +Do not continue the Python/OpenGL bridge. Rehydrate, read `docs/native-rebuild-plan.md`, then cut toward the native rolling reservoir. diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 097d7d0..e471be2 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -41,3 +41,14 @@ {"ts": "2026-05-18T15:44:14+00:00", "type": "verification", "status": "ok", "note": "Remote Focusrite shotgun capture path verified: SSH to 192.168.1.84 runs remote FFmpeg against Analogue 1 + 2 (Focusrite USB Audio), SFTP pulls a mono 48 kHz float WAV into a distributed calibration run, and the manifest records mic_focusrite_neighbor as field channel 5."} {"ts": "2026-05-18T15:59:44+00:00", "type": "verification", "status": "partial", "note": "Simultaneous audio-field calibration run audio-full-sync-20260518-165751 captured local Kiyo-left, both PS Eye mics, local Focusrite, and neighbor Focusrite shotgun. Chirplet analysis aligned five sources; Kiyo-right remains missing. Response-compensated six-channel field and FOA AmbiX WAV were produced under calibration/runs/audio-full-sync-20260518-165751."} {"ts": "2026-05-18T16:06:28+00:00", "type": "verification", "status": "ok", "note": "Visual pipeline now uses typed CultCache MessagePack state: live_sensor_fusion.py writes localcast.visual.render_frame to visual-state.msgpack, stream_spout.py consumes that document and publishes Spout. CultNet document_put is documented as the API boundary; JSON render-frame files are compatibility only. Live OBS heartbeat shows 256 fused points from visual-state.msgpack."} +{"ts": "2026-05-18T16:08:52+00:00", "type": "decision", "status": "ok", "note": "Aquarium/Faust spatial audio boundary is a typed CultCache document localcast.audio.spatial_frame carrying live 48 kHz AmbiX ACN/SN3D W,Y,Z,X float32 blocks with start_sample and audio_time_ns; Aquarium owns native Faust DSP while LocalCastBridge owns capture, sync, calibration, and AmbiX publication."} +{"ts": "2026-05-18T16:31:23+00:00", "type": "verification", "status": "partial", "note": "Dense chirplet texture run 20260518T163026.517259Z-audio-probe-train emitted 120 usable low-level multi-band speaker probes over 8s. Band-aware analysis produced per-mic phase-frequency correction vectors and smoothed sub-sample phase deltas, but coarse delays still include large device/driver latency terms; geometry requires a joint solve separating latency/drift from acoustic path."} +{"ts": "2026-05-18T16:40:56+00:00", "type": "verification", "status": "partial", "note": "Room suppression first cut added: suppress-room treats Focusrite dialogue anchors as desired direct sources and camera mics as room/transient witnesses, attenuating witness-heavy broadband transients before FOA. On audio-full-sync-20260518-165751 it wrote field-cleaned.wav and field-cleaned-foa-ambix.wav, reducing aligned RMS from 0.00162 to 0.00126 and FOA RMS from 0.000408 to 0.000308 while firing on 101 transient blocks."} +{"ts": "2026-05-19T00:42:22+00:00", "type": "decision", "status": "ok", "note": "Live fusion horizon is a five-second spatiotemporal reservoir: frame history expires from the newest shared sample, LOD evidence is clipped to that window, and RenderFramePacket declares the source window. Live audio field now owns local mic/phase capture with closed-loop Scarlett probes, bounded probe artifacts, and 44.1 kHz probe playback resampling."} +{"ts": "2026-05-19T00:45:41+00:00", "type": "decision", "status": "ok", "note": "Multi-LOD scene cache now carries first-pass material evidence per cell: weighted albedo plus roughness/metallic hints derived from source evidence. Aquarium owns final BRDF refinement, but it now receives relightable material state from the five-second reservoir."} +{"ts": "2026-05-19T00:57:57+00:00", "type": "verification", "status": "partial", "note": "Direct synchronous visual capture cannot currently satisfy the five-second live reservoir: RGB-only 8s probe took ~21.8s and Leap-only 8s probe took ~13.5s with MSMF/libusb errors. Deadline run now uses rgb/leap fallback-only mode plus Spout reservoir clamping, producing synchronized OBS output at audio_delta_ns 0 with ~1.5k points. Next cut is nonblocking camera ingress."} +{"ts": "2026-05-19T01:05:40+00:00", "type": "verification", "status": "ok", "note": "Nonblocking camera ingress cut: LatestFramePump moves OpenCV capture reads off the live fusion hot loop. Restarted live visual producer with lower per-frame density (--points 64, rgb/leap step 16); Spout heartbeat reported audio_delta_ns 0 and ~1.6k visual points under the five-second reservoir."} +{"ts": "2026-05-19T01:09:34+00:00", "type": "verification", "status": "ok", "note": "Active probe maintenance now filters to live captured source ids in stream_live_audio_field; missing placeholders such as co-streamer-focusrite remain stable output channels but no longer consume chirp budget. Live restart showed probes targeting ps-eye-0 with playback error empty."} +{"ts": "2026-05-19T06:31:33+00:00", "type": "decision", "status": "ok", "note": "Perfect Machine target is now explicit: LocalCastBridge owns config/calibration/status, Aquarium owns dense GPU fusion/material/brush rendering and Spout publication, Faust owns hot audio DSP, and one five-second native reservoir is the live authority. Python remains tooling and compatibility, not the stream hot path."} +{"ts": "2026-05-19T06:35:13+00:00", "type": "implementation", "status": "ok", "note": "Started native Perfect Machine runtime with native/reservoir Rust crate. It owns shared-edge five-second sample retention for typed rings and passes cargo tests; Aquarium/Faust bindings should build on this invariant instead of copying deadline bridge caches."} +{"ts": "2026-05-19T07:39:41+00:00", "type": "decision", "status": "ok", "note": "Native rebuild cut line recorded: live path must abandon Python producers, OpenGL Spout sink, JSON live stores, and independent typed rings; next foundation is one native rolling reservoir with typed indexes/views feeding Aquarium, Faust, OBS, and typed CultNet docs."} diff --git a/state/map.yaml b/state/map.yaml index 719e2e9..c1ef243 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -4,8 +4,9 @@ workspace: focus: perfect-machine-native-reservoir premise: > A second Windows PC should appear inside OBS as video plus separately - mixable audio sources. Use ordinary media transport first; native OBS code - only earns its keep after standard OBS/FFmpeg surfaces fail a real invariant. + mixable audio sources. The synchronized program path now cuts away the + Python/OpenGL deadline bridge and rebuilds around one native rolling + reservoir feeding Aquarium, Faust, CultNet, and OBS. objective: primary: > @@ -13,8 +14,9 @@ objective: microphones, two speakers, Leap timing, Aquarium GPU rendering, Faust DSP, and OBS output. current: > - Cut the deadline bridge down to tooling and define the native five-second - reservoir contract Aquarium/Faust must implement. + Carve out Python live producers, the OpenGL Spout sink, JSON live stores, + and duplicated reservoir windows. Rebuild the live path around one native + rolling buffer with typed indexes/views and CultNet typed documents. constraints: - Sender is Windows. @@ -23,6 +25,10 @@ constraints: - Audio sources must remain separately controllable in OBS. - V1 is LAN-only. - Persistent state must clarify rehydrate, not become transcript tax. + - No Python live hot path. + - No OpenGL production Spout sink. + - Edge JSON is schema/diagnostic only; live network/process data is typed + CultNet documents. invariants: - OBS composition authority stays in OBS. @@ -31,10 +37,21 @@ invariants: - Video endpoint uses H.264 over MPEG-TS/SRT. - Audio endpoints default to AAC over MPEG-TS/SRT for broad OBS/FFmpeg compatibility. - Local secrets remain untracked. + - One native rolling reservoir owns the live edge and expiry. + - Typed views may index the rolling buffer, but no per-kind ring owns + retention. + - Aquarium owns production Spout publication; Faust/native DSP owns hot audio. + - Python and JSON may diagnose or test the machine, not run it. accepted_design: + - `docs/native-rebuild-plan.md` is the current cut plan. It supersedes the + deadline Python/OpenGL bridge as a foundation and defines the next coherent + rebuild target. - `docs/perfect-machine.md` and `config/perfect-machine.example.json` define the native target: one five-second spatiotemporal reservoir, Aquarium GPU fusion/rendering, Faust DSP, OBS output controls, and LocalCastBridge tooling. - - `native/reservoir` is the first native Rust crate. It implements shared-edge reservoir rings so all sample types expire from the newest live sample rather than private source histories, and exposes a C ABI for Aquarium/Faust handle-based integration plus `LocalcastRuntime` typed producer calls. + - `native/reservoir` is the first native Rust crate. Its current shared-edge + typed rings proved the expiry invariant, but the live target is stricter: + one time-ordered rolling buffer with typed indexes/views, so retention has + exactly one owner. - `config/localcast.example.json` defines receiver address, base port, video encode settings, and audio sources. - `scripts/sender-discover.ps1` lists FFmpeg devices, protocols, and encoders. - `scripts/sender-start.ps1` launches one FFmpeg process per enabled source. @@ -42,6 +59,10 @@ accepted_design: - Persistence follows the active repo pattern: map, scratch, evidence, branches, handoff, system map, implementation plan, state helpers. active_subgoals: + - Rewrite `native/reservoir` from independent typed rings into one rolling + buffer with typed indexes/views and a single edge. + - Delete or quarantine Python live producers and the OpenGL Spout sink before + adding new live features. - Bind Aquarium/Faust to `LocalcastRuntime` in the native reservoir C ABI described by `native/reservoir/include/localcast_reservoir.h`. - Move dense visual fusion/material fitting/brush generation into Aquarium GPU compute. - Move hot audio DSP/voice separation/room suppression/spatialization into Faust/native runtime. @@ -128,13 +149,11 @@ research: live_spout_deadline_sink: summary: docs/obs-spout-streaming.md key_decision: > - The deadline OBS surface is a real Spout sender named LocalCastBridge - Point Cloud. `scripts/stream_spout.py` consumes render-frame packets, - lowers them into compact anisotropic screen brush packets inspired by the - Zyphos/Aquarium brush model, uploads the texture through SpoutGL, and - writes a heartbeat status file. This is a sink boundary, not a new scene - authority; Aquarium should replace the renderer body behind the same - RenderFramePacket contract for dense brush/splat rendering. + The deadline OBS surface proved the need for a named Spout sender, but it + is not a foundation. `scripts/stream_spout.py`, SpoutGL/OpenGL rendering, + Python render-frame production, and JSON heartbeat stores are diagnostics + or migration fossils only. Production Spout publication belongs in + Aquarium, fed by the native rolling reservoir and typed CultNet documents. live_audio_phase_meaning: summary: docs/audio-field.md key_decision: > @@ -222,8 +241,9 @@ research: `localcast.visual.render_frame` in `calibration/runs/visual-state.msgpack` and `localcast.visual.stream_status` in `calibration/runs/visual-stream-status.msgpack`. CultNet document_put is - the intended process/network API boundary. JSON render-frame files are no - longer the authority. + the intended process/network API boundary. Edge JSON may define schemas + or export diagnostics, but runtime data should remain typed documents + because every networked subsystem is under our control. current_status: summary: > @@ -328,31 +348,9 @@ current_status: stochastic transient hypotheses, and synthetic fusion support while still seeing lower-priority fallback diagnostics when the Leap capture path stalls. next_action: > - Capture real ChArUco intrinsics for the PS3 Eyes and Kiyos, capture - fixed-board observations from every camera, solve a local - `config/sensor-fusion.json`, and prove calibrated cross-view surface tracks - with `scripts/triangulate_surface_features.py`. Then move the dense RGB stereo matcher - to a GPU-resident stereo/flow pass so high-detail surface claims can scale - toward the million-splat temporal accumulator without Python owning each - point. If a Tuya light is available, run the local-key pulse hook and record - its timestamps against camera responses as active illumination evidence. - Then replace the synthetic live producer with a detector adapter that - turns FFmpeg PS3 Eye frames into marker `Observation2D` records for the - fusion core and publishes the same typed CultCache/CultNet render-frame - document. Calibrate Leap as a geometric camera model so clap timing peaks - can become direct 3D rays instead of timing-only evidence. Also fix the live Leap capture backend so the cache emits - `leap-ground-truth` rather than `leap-fallback`; current MSMF probing can - still stall on frame reads. In parallel, move the render-frame consumer into Aquarium Engine so - Aquarium renders cached points/brushes into its GPU render target and - publishes or hands off the same Spout sender `LocalCastBridge Point Cloud` - for OBS, replacing the deadline OpenGL point sink without changing packet - ownership. In parallel, create local - `config/audio-field.json`, confirm local - Kiyo/PS Eye/Focusrite device matches, confirm the neighbor Focusrite - shotgun capture/transport path, replace placeholder mic/speaker geometry - with measured world coordinates, then build the delay/SRO alignment stage - that feeds the bounded field cache and emits aligned six-channel blocks for - FOA encoding. Keep neighbor loopback on the scheduled interactive WASAPI - capture path and use it as the timing witness once actual neighbor app - audio is present; do not reintroduce a virtual mixer unless direct loopback - fails a concrete invariant that the mixer actually satisfies. + Stop live feature work on the Python/OpenGL bridge. First rewrite + `native/reservoir` into a single time-ordered rolling buffer with typed + indexes/views, update the ABI/tests around that invariant, and quarantine + Python/OpenGL code as diagnostics. Then bind Aquarium/Faust to the native + runtime and resume hardware calibration through typed CultNet/native + surfaces only.