Commit Graph

9 Commits

Author SHA1 Message Date
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