Commit Graph

26 Commits

Author SHA1 Message Date
david 3db6b5904c Add service health indicators to LED matrix viz
Validate and Test / validate-patches (push) Failing after 13s
- Column 12 shows service health (top row = service dots)
- Periodic diagnostic flash every 10s (idle only)
- Services monitored: midi-bridge, pd-synth, viz, prometheus, audio
- MIDI note viz uses columns 0-11, rows 1-7
2026-06-24 17:40:17 -07:00
david f547201c98 fix: non-blocking response drain using setblocking(False)
Validate and Test / validate-patches (push) Failing after 12s
2026-06-24 05:23:19 -07:00
david 88ddf740cf fix: use REQUEST (type 0) + drain response after each send
Validate and Test / validate-patches (push) Failing after 13s
RouterBridge on MCU ignores NOTIFICATION (type 2) messages.
Must use REQUEST (type 0) for draw_frame, then drain the
response to prevent router buffer buildup.
2026-06-24 05:20:26 -07:00
david 86facfea38 clean: remove debug logging, final viz cleanup
Validate and Test / validate-patches (push) Failing after 12s
2026-06-24 05:14:33 -07:00
david 4f07a4007f fix: use NOTIFICATION (type 2) for draw_frame RPC
Validate and Test / validate-patches (push) Failing after 12s
Viz was sending REQUEST (type 0) but never reading responses.
Router response buffer filled up, blocking all subsequent RPCs.
NOTIFICATION (type 2) expects no response — no buffer buildup.
2026-06-24 05:09:53 -07:00
david 2af901bdca debug: add real-time logging to viz (note on/off, frame sent/drop)
Validate and Test / validate-patches (push) Failing after 12s
2026-06-24 05:03:32 -07:00
david 39e9b5c2fa fix: no reconnect storm on send failure, reduce refresh to 1 FPS
Validate and Test / validate-patches (push) Failing after 13s
- try_send: don't reconnect on failure, just skip and retry next cycle
- Background refresh: 5 FPS → 1 FPS to reduce router serial load
- Revert Bridge.run() - RouterBridge uses Zephyr RTOS thread
2026-06-24 04:59:09 -07:00
david f43d046153 fix: restore executable permission on viz script
Validate and Test / validate-patches (push) Failing after 13s
2026-06-24 04:55:37 -07:00
david 3b40592055 fix: robust router send with auto-reconnect, 10ms timeout
Validate and Test / validate-patches (push) Failing after 13s
- try_send() helper: reconnect on send failure
- 10ms socket timeout instead of 300ms (stalls poll loop)
- Refresh path also uses try_send
- Remove committed library bloat from repo (add .gitignore)
2026-06-24 04:46:59 -07:00
david f70a8701c9 fix: make router socket non-blocking to prevent poll loop stalls
Validate and Test / validate-patches (push) Failing after 13s
2026-06-24 04:45:15 -07:00
david 7af3874757 fix: event-driven viz with immediate rendering, zero decay, clean stats
Validate and Test / validate-patches (push) Failing after 12s
Rewrite led-matrix-viz.py to eliminate latency:
- Render and pack frame immediately on each MIDI event
- Send on next poll cycle (no POLLOUT dependency, no frame loop)
- Notes on/off purely from MIDI data — zero decay
- Background 5 FPS refresh for router drop recovery
- Clean stats: FPS, active_notes, midi_events, bytes_received, raw_packets
2026-06-24 04:09:41 -07:00
david 1d431c8902 debug: print note on/off to journal
Validate and Test / validate-patches (push) Failing after 13s
2026-06-24 04:08:24 -07:00
david 979e89e305 fix indentation and debug: add pipeline counters
Validate and Test / validate-patches (push) Failing after 13s
2026-06-24 04:07:17 -07:00
david 89da97c637 debug: log raw message content to journal
Validate and Test / validate-patches (push) Failing after 13s
2026-06-24 04:03:01 -07:00
david 515617ac94 debug: add bytes_received and raw_packets to viz stats
Validate and Test / validate-patches (push) Failing after 12s
2026-06-24 03:59:12 -07:00
david a94ac07a5c fix: pack frame at render time, send without POLLOUT dependency
Validate and Test / validate-patches (push) Failing after 13s
- pending_bytes stores already-packed msgpack, sendable immediately
- Try sendall() directly every iteration — no POLLOUT gate
- Refresh path resends last_sent_params (not raw frame tuple)
- Router socket uses settimeout instead of setblocking for simpler I/O
2026-06-24 03:56:50 -07:00
david 68d38de9a5 fix: rewrite viz as event-driven with zero-latency MIDI rendering
Validate and Test / validate-patches (push) Failing after 13s
- Remove frame loop latency: render and send immediately on MIDI event
- Remove decay: notes on/off based purely on MIDI note-on/note-off
- Background 5 FPS refresh: catch router-dropped frames
- active_notes uses set instead of dict with decay counters
- Simpler stats: FPS, active notes, midi events processed
2026-06-24 03:31:12 -07:00
david 5115518b5f fix: reduce viz decay to 3 frames, add max-age safety cap, add FPS stats
Validate and Test / validate-patches (push) Failing after 12s
- DECAY_FRAMES default 8→3 (100ms visual trail)
- MAX_NOTE_AGE safety cap: force-expire notes after 15 frames
- Track note age separately from decay to prevent stale notes
- Add FPS and active_notes to viz stats for diagnostics
- Fix router reconnect: unregister old fd, not new one
2026-06-24 03:27:10 -07:00
david 7706517b88 fix: initialize stats_last_write inside main() to avoid UnboundLocalError 2026-06-24 02:39:37 -07:00
david ad55dbc5e0 add viz diagnostic metrics to prometheus-exporter
- Viz writes stats to /tmp/viz-stats.json (frames_sent, frames_dropped, queue_depth)
- Exporter reads viz-stats.json and exposes:
  - viz_frames_sent_total (counter)
  - viz_frames_dropped_total (counter)
  - viz_pending_queue (gauge)
  - viz_queue_full (gauge)
2026-06-24 02:38:51 -07:00
david 5c95aa6cd0 viz: proper POLLOUT queue to prevent frame drops
- FrameQueue (max 5) buffers frames when router is slow
- POLLOUT drains pending_frames queue
- No silent drops — full queue increments counter
- Router always registered POLLIN| POLLOUT
- Frame interval 30ms (33 FPS)
2026-06-24 02:37:46 -07:00
david 272a13f8d9 viz: increase FPS to 30, drain UDP aggressively
- Poll timeout capped at 10ms for responsiveness
- Drain all pending UDP data before parsing
- Auto-reconnect router on error
- FPS 15 -> 30
2026-06-24 02:33:17 -07:00
david 3cc497f632 refactor: 3-module pd architecture + viz non-blocking fix
- midi-in.pd: netreceive -> route -> unpack -> pitch/velocity outlets
- audio-out.pd: inlet~ -> dac~ abstraction
- synth.pd: consumer patch wiring midi-in -> voice -> audio-out
- led-matrix-viz.py: router socket non-blocking, registered with poller
- pd.rego: skip outlet/abstraction false positives in validation
2026-06-24 02:08:57 -07:00
david d239d58c44 onboard audio: JMISC HPH wiring, UCM fix, update scripts for git deploy 2026-06-23 21:25:51 -07:00
david f1b65eb4d9 fix led-matrix-viz: use select.poll() instead of settimeout, fix hang
The O_NONBLOCK flag set by setblocking(False) was not cleared by
settimeout(n) on this CPython/kernel combo, causing recvfrom to never
return data. Switched to explicit select.poll() with frame-interval
based timeout — simpler, more portable, and avoids the O_NONBLOCK trap.

Also fixes midi-bridge: add time.sleep(0.01) in no-data paths to
prevent 100% CPU spin from spurious POLLIN on f_midi rawmidi.
2026-06-23 00:34:33 -07:00
david 8cd796e3dd Initial commit: Arduino Uno Q USB Audio Synth project
- USB gadget (UAC1 + MIDI) with boot persistence
- USB host mode with auto-detection
- Pure Data synth patch with ALSA + UDP netreceive MIDI input
- MIDI rawmidi-to-UDP bridge (midi-bridge.py)
- LED matrix visualization (led-matrix-viz.py via arduino-router RPC)
- MCU sketch for LED matrix control (Arduino_RouterBridge + ArduinoGraphics)
- Conftest/OPA Rego policy validation suite for .pd files
- gen_synth_pd.py: programmatic .pd file generator
- System services: midi-bridge, led-matrix-viz, pd-synth-auto, usb-role-detect
- Justfile with deploy, enable, diagnostic recipes
- Diagnostic script (diag.sh)
2026-06-22 22:46:36 -07:00