Commit Graph

122 Commits

Author SHA1 Message Date
Claude
96d7825c34 docs(04-01): complete timeline canvas foundation plan — SUMMARY, STATE, ROADMAP updated
- SUMMARY: timeline canvas with per-device tracks, waveform, beat marks, playback cursor
- STATE: plan advanced to 2/4, progress 79%, decisions and metrics recorded
- ROADMAP: Phase 4 progress updated (1/4 plans complete, In Progress)
- Requirements TL-01, TL-05 marked complete
2026-04-06 23:35:29 +00:00
Claude
efa612380c feat(04-01): TimelineCanvas class + CSS + app.js wiring
- Create lightsync/frontend/timeline/timeline.js with TimelineCanvas class
  - Per-device horizontal tracks with track headers and time axis
  - HiDPI canvas rendering with devicePixelRatio handling
  - Waveform peaks background layer, beat marks overlay, cue block rendering
  - Playback cursor synced to audio.currentTime via requestAnimationFrame
  - Auto-scroll when cursor approaches right edge
  - Mouse wheel scrolling on timeline canvas
  - loadTracks(), loadWaveform(), loadBeats() data loading methods
  - Empty state messages when no devices or audio loaded
- Add timeline CSS to style.css (toolbar, canvas, inspector strip, snap button)
- Wire timeline into app.js: import, initTimeline(), zoom/beat-offset/snap controls
- Remove old animation-grid click listener (element no longer exists in main-area)
- Populate animation palette dynamically in sidebar with 7 animation types
2026-04-06 23:34:32 +00:00
Claude
454fddc35e feat(04-01): data model changes + HTML layout restructure
- Add CueModel.duration field (float = 4.0) for block length in seconds
- Add AnalysisBlock.calibration_offset field (float = 0.03) for librosa bias
- Replace main-area animation grid with timeline canvas layout (toolbar, canvas, inspector)
- Move ANIMATIONS panel into sidebar below DEVICES panel
- Add timeline-toolbar with zoom slider, beat offset input, snap toggle
2026-04-06 23:30:55 +00:00
Claude
22f31cdad0 docs(phase-04): mark planning complete 2026-04-06 23:25:04 +00:00
Claude
78c5d6256d docs(phase-04): add phase plans (4 plans, 3 waves) 2026-04-06 23:24:46 +00:00
Claude
e8e0532972 docs(04): create phase plan 2026-04-06 23:24:11 +00:00
Claude
5f46f6f8a1 docs(04): UI design contract 2026-04-06 23:11:02 +00:00
Claude
f2abc04dcc docs(04): UI design contract for timeline editor phase
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 23:09:42 +00:00
Claude
9d9cd935b6 docs(phase-04): capture context for timeline editor phase
Inspector panel below timeline (above transport) confirmed.
Block data model, canvas tech, and undo/redo architecture left to Claude's discretion with recommendations noted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 22:14:06 +00:00
Claude
5a84e55059 docs(phase-03): evolve PROJECT.md after phase completion 2026-04-06 21:56:19 +00:00
Claude
73d50d04a8 docs(phase-03): complete phase execution 2026-04-06 21:55:48 +00:00
Claude
299612589b docs(03-03): complete UDP simulator and FastAPI integration plan
- Create 03-03-SUMMARY.md: simulator, e2e tests, lifespan integration
- Update STATE.md: advance plan, 100% progress, record decisions
- Update ROADMAP.md: phase 03 marked Complete (3/3 plans)
- Mark UDP-04 requirement complete in REQUIREMENTS.md
2026-04-06 21:52:37 +00:00
Claude
509911f5c5 feat(03-03): integrate UDPSender into FastAPI lifespan
- Import UDPSender in main.py
- Start UDPSender on app boot, assign to app.state.udp_sender
- Stop UDPSender cleanly on shutdown (before registry.save)
- All existing lifespan behavior unchanged (beats, registry, show_store)
2026-04-06 21:51:40 +00:00
Claude
f3f0baff51 feat(03-03): implement UDP simulator with packet logging — GREEN
- SimulatorProtocol parses DRGB, DRGBW, DNRGB, ANIM_CMD packets
- PacketLog dataclass stores led_count, start_index, decoded cmd
- run_simulator() async factory for test and standalone use
- Runnable as __main__ standalone server on WLED_PORT
- All 7 e2e tests pass
2026-04-06 21:51:16 +00:00
Claude
3829f81a5f test(03-03): add failing e2e protocol tests — RED
- 7 e2e tests covering DRGB, DRGBW, DNRGB, ANIM_CMD, full pipeline, SK6812, standalone import
- Uses asyncio.run() pattern (no pytest-asyncio dependency)
- All tests fail with ModuleNotFoundError: simulator not yet implemented
2026-04-06 21:50:40 +00:00
Claude
99cde0331d docs(03-02): complete animation library plan
- Add 03-02-SUMMARY.md with 7 animation types documented
- Advance STATE.md to plan 3/3 in phase 03
- Mark ANI-01, ANI-02 complete in REQUIREMENTS.md
- Update ROADMAP.md phase 3 progress (2/3 plans done)
2026-04-06 21:48:43 +00:00
Claude
f4da9564d4 feat(03-02): implement animation library — 7 types with registry and factory
- AnimationBase ABC with render(t, led_count) and from_params() contract
- SolidColorAnimation: time-independent uniform fill
- ChaseAnimation: moving lit segment with forward/reverse support
- PulseAnimation: sine-wave breathing effect (speed maps to period)
- RainbowAnimation: HSV hue cycle across strip via colorsys.hsv_to_rgb
- StrobeAnimation: on/off flashing at 1-20 Hz with configurable duty cycle
- ColorWipeAnimation: progressive fill from start or end
- FireAnimation: Fire2012 algorithm with cooling/sparking/heat-to-color mapping
- ANIMATION_REGISTRY + create_animation() factory function
- All 24 tests passing
2026-04-06 21:47:39 +00:00
Claude
920243fcae test(03-02): add failing tests for animation library
- Tests for all 7 animation types (solid_color, chase, pulse, rainbow, strobe, color_wipe, fire)
- Tests for AnimationBase ABC contract
- Tests for ANIMATION_REGISTRY and create_animation() factory
- Tests for from_params() on all types
- Length invariant test covering all animations
2026-04-06 21:45:54 +00:00
Claude
af530cfe60 docs(03-01): complete protocol encoders plan — SUMMARY, STATE, ROADMAP updated
- 03-01-SUMMARY.md: WLED encoders, animation cmd, UDP sender, 27 passing tests
- STATE.md: advanced to plan 2/3, progress 80%, decisions recorded
- ROADMAP.md: phase 3 plan progress updated (1/3 complete)
- REQUIREMENTS.md: marked UDP-01/02/03, ANI-03/04 complete
- pyproject.toml: pytest added as dev dependency
- uv.lock: updated lockfile
2026-04-06 21:43:59 +00:00
Claude
f17e77f7bb feat(03-01): UDP sender and device stub completion
- UDPSender: single shared asyncio DatagramTransport, start/stop lifecycle, fire-and-forget send()
- _NullProtocol: swallows OS send errors (UDP delivery is best-effort for LEDs)
- SK6812Device.encode_animation_cmd: replaces b'' stub with real 16-byte 0xAC packet
- WS2801Device.encode_animation_cmd: replaces b'' stub with real 16-byte 0xAC packet
- Both devices delegate to encode_animation_cmd from lightsync.protocol.animation_cmd
2026-04-06 21:42:29 +00:00
Claude
5e13da3967 feat(03-01): implement WLED protocol encoders and animation command packet
- encode_drgb/encode_drgbw: 2-byte header + RGB/RGBW body, truncate at MTU max
- encode_dnrgb_packets: splits large frames into 489-LED chunks with big-endian start index
- encode_animation_cmd: 16-byte 0xAC packet with speed (float32), color, flags, density
- decode_animation_cmd: full inverse round-trip for all 7 animation types
- All 27 tests pass
2026-04-06 21:40:52 +00:00
Claude
ffc4ef6dc6 test(03-01): add failing tests for protocol encoders and animation command
- DRGB/DRGBW/DNRGB encoder behavior tests (byte layout, MTU, truncation)
- DNRGB start index big-endian byte order tests
- Animation command 0xAC packet tests (all 7 types, roundtrip, flags)
- Tests fail: lightsync.protocol.drgb and animation_cmd modules do not exist yet
2026-04-06 21:40:02 +00:00
Claude
75ec1158b7 docs(03): create phase plan — protocol encoders, animation library, simulator 2026-04-06 21:33:27 +00:00
Claude
32ce615a63 docs(03): research communication protocol — WLED UDP spec, async sender, animation library 2026-04-06 21:28:01 +00:00
Claude
37f483e880 feat(02): controller UI — vertical anim list, play/pause, browser audio, terminal aesthetic
- Replace waveform+DAW layout with animation controller
- Animations as vertical list with > cursor, no icons
- Transport: play/pause button, seek slider, time display
- Browser <audio> handles playback, 10Hz ticks to server
- Sidebar: devices only (200px)
- python:3.11-slim base (replaces Alpine, fixes librosa/numba build)
- libsndfile symlink kept for soundfile
- Remove python-mpv, add librosa for beat detection
2026-04-06 17:32:11 +00:00
Claude
9c1ca03957 docs(02-03): complete architecture redesign — browser audio + librosa beat detection
- 02-03-SUMMARY.md: full redesign summary, decisions, deviations documented
- STATE.md: decisions updated, session recorded, progress at 100% (7/7 plans)
- ROADMAP.md: Phase 2 confirmed Complete (3/3 plans)
2026-04-06 15:40:55 +00:00
Claude
0963ad4a70 fix(02-03): fix upload file selection — pass abs path to refreshFileList
- Options use /app/shows/filename as value
- Upload response returns /app/shows/filename as path
- Pass path directly to refreshFileList so pre-selection matches
2026-04-06 15:39:21 +00:00
Claude
f1941a90db feat(02-03): redesign frontend — browser audio element, beat markers, animation selector
- index.html: add <audio id=player> (hidden), beat-indicator dot in header
- index.html: animation selector panel with Beat Pulse/Strobe/Color Wave/Rainbow options
- index.html: remove seek slider + time display (browser audio element has native controls)
- index.html: upload button + file selector remain in transport bar
- app.js: wire <audio> element — play/pause/seeked/timeupdate events send WS ticks
- app.js: 10Hz setInterval tick loop (supplements native timeupdate ~4Hz)
- app.js: WS beat message -> flashBeatIndicator() animation
- app.js: loadWaveformAndBeats() draws waveform peaks + beat marker lines on canvas
- app.js: loadSelectedFile() sets audio.src=/shows/filename, fetches beats+waveform
- app.js: upload response caches beat data returned from server immediately
- style.css: .beat-indicator with .beat-flash (yellow glow animation)
- style.css: .animation-select-input for the animations panel dropdown
2026-04-06 15:38:30 +00:00
Claude
1f1ff92446 chore(02-03): delete lightsync/audio/engine.py (MPV engine removed)
- Browser plays audio now; server-side MPV engine is no longer used
- Beat detection via librosa replaces position-polling engine
2026-04-06 15:37:10 +00:00
Claude
6366d8468f feat(02-03): remove MPVEngine from main.py, add beats cache and shows static route
- Remove MPVEngine import, engine module-level var, and lifespan start/stop logic
- Remove broadcast_loop task (no server-side position polling)
- Add app.state.beats = {} dict (filepath -> beat data cache) in lifespan startup
- Mount /shows as StaticFiles so browser <audio src=/shows/file.mp3> works
- Simplified lifespan: registry + show_store + beats init only
2026-04-06 15:37:06 +00:00
Claude
2c9ca0d6b4 feat(02-03): redesign WebSocket protocol — browser tick-driven beat detection
- Remove server-side broadcast_loop (MPV position polling eliminated)
- Browser sends {type: tick, position: N} at ~10Hz
- Server looks up nearest beat within 50ms window, sends {type: beat, position, tempo}
- Browser sends play/pause/seek events (logged, no UDP yet)
- Browser sends {type: load, path} to switch beat cache to specific file
- _find_nearest_beat() uses bisect for O(log n) lookup
- Per-connection beat state: current_file, beats list, tempo, last_beat_reported
2026-04-06 15:36:50 +00:00
Claude
636160e9a1 feat(02-03): redesign audio.py — browser-audio architecture, beat endpoint
- Remove engine dependency entirely (no MPVEngine, no app.state.engine)
- POST /api/audio/upload: saves file, runs librosa beat analysis, caches in app.state.beats
- GET /api/audio/beats?path=...: returns cached or on-demand beat analysis
- GET /api/audio/waveform?path=...: now takes path query param (no engine state lookup)
- GET /api/audio/files: unchanged
- Removed POST /api/audio/load and GET /api/audio/state (engine-only endpoints)
2026-04-06 15:36:21 +00:00
Claude
92cc09e908 feat(02-03): add librosa beat detection module (lightsync/audio/beats.py)
- analyze(path) -> {tempo: float, beats: [float, ...]} using librosa.beat.beat_track
- Returns beat timestamps in seconds converted from librosa frame indices
- analyze_async() wraps in asyncio.to_thread for non-blocking use from FastAPI
- Supports MP3/WAV/FLAC/OGG via librosa's ffmpeg/soundfile fallback chain
2026-04-06 15:35:58 +00:00
Claude
cce76a2b1c chore(02-03): remove mpv-libs from Dockerfile, keep ffmpeg and libsndfile
- Remove mpv-libs and libmpv.so symlink (browser plays audio now)
- Keep ffmpeg/ffmpeg-libs (used by librosa and waveform extraction)
- Keep libsndfile and its symlink (used by soundfile package)
2026-04-06 15:35:43 +00:00
Claude
5d93294b97 chore(02-03): replace python-mpv with librosa>=0.10.0 in pyproject.toml
- Remove python-mpv>=1.0.5 (server-side playback replaced by browser audio)
- Add librosa>=0.10.0 for beat detection and tempo analysis
- Keep soundfile, numpy, python-multipart (still needed)
2026-04-06 15:35:35 +00:00
Claude
9239988d38 fix(02): Alpine libmpv/libsndfile symlinks, upload endpoint, browser file picker
- Dockerfile: add libmpv.so + libsndfile.so symlinks (Alpine/musl has no ldconfig)
- engine.py: monkey-patch ctypes.util.find_library as fallback for Alpine
- audio.py: add /upload (multipart) and /files endpoints
- pyproject.toml: add python-multipart
- frontend: replace path input with upload button + file selector dropdown
2026-04-06 15:34:11 +00:00
Claude
7f9efee47a docs(02-03): complete waveform display and transport UI plan — AUD-05 fulfilled
- SUMMARY.md for 02-03 (waveform extractor + transport UI)
- STATE.md: checkpoint at human-verify task 3, decisions recorded
- ROADMAP.md: phase 2 progress updated (3/3 plans)
- REQUIREMENTS.md: AUD-05 marked complete
2026-04-06 13:15:17 +00:00
Claude
148f16ba5e feat(02-03): build transport UI and waveform canvas
- Replace timeline placeholder with waveform canvas + playback cursor
- Replace transport placeholder with full transport bar controls
- Add play/pause/stop buttons, seek slider, time display, audio path input
- Add drawWaveform(), loadWaveform(), updatePosition(), formatTime() to app.js
- Dispatch msg.type=tick to updatePosition in handleMessage
- Wire transport buttons via WebSocket commands
- Add transport/waveform styles to style.css using existing CSS variables
- Deploy via ~/bin/deploy.sh
2026-04-06 13:14:05 +00:00
Claude
da474d978d feat(02-03): add waveform extraction module and HTTP endpoint
- Create lightsync/audio/waveform.py with extract_peaks() (AUD-05)
- MP3 via ffmpeg pipe, WAV/FLAC/OGG via soundfile+numpy
- Add GET /api/audio/waveform endpoint with asyncio.to_thread
- peaks param clamped 100-5000, returns {peaks, count, file}
2026-04-06 13:11:38 +00:00
Claude
3de7f43b3f docs(02-02): complete audio engine plan 02 — WebSocket broadcast + REST audio endpoints
- SUMMARY: WebSocket hub wired to broadcast MPV position at 10Hz, command dispatch
- STATE: plan advanced to 3/3, progress 86%, decisions added
- ROADMAP: phase 2 progress updated (2/3 summaries)
- REQUIREMENTS: AUD-02, AUD-04 marked complete
2026-04-06 13:08:54 +00:00
Claude
de455400d2 feat(02-02): add REST audio load endpoint with file validation
- Create lightsync/api/audio.py with POST /load and GET /state endpoints
- Validate file existence and extension (.mp3/.wav/.flac/.ogg)
- Use asyncio.to_thread for engine.load to avoid blocking event loop
- Return 404/400/503 on error conditions
- Register audio router at /api/audio prefix in main.py
- AUD-02 (YouTube) noted as Phase 6 deferral
2026-04-06 13:07:45 +00:00
Claude
5e400a6834 feat(02-02): wire WebSocket broadcast loop and command dispatch
- Add broadcast_loop sending position ticks at 10Hz to all clients
- Replace echo stub with play/pause/seek/load command dispatch to MPVEngine
- Start broadcast_loop as asyncio task in lifespan, cancel on shutdown
- Use get_engine callable to avoid circular import at module level
2026-04-06 13:07:18 +00:00
Claude
3173fa2228 docs(02-01): complete audio engine plan 01 — MPVEngine, SUMMARY, STATE, ROADMAP updated
- Create 02-01-SUMMARY.md with task commits, decisions, self-check
- Advance plan counter to plan 2 of 3
- Update progress to 71% (5/7 plans complete)
- Add 3 key decisions to STATE.md
- Mark AUD-01, AUD-03, INF-03 complete in REQUIREMENTS.md
- Update ROADMAP.md phase 2 progress
2026-04-06 13:05:02 +00:00
Claude
5f75a19868 feat(02-01): implement MPVEngine with position polling and lifespan integration
- Create lightsync/audio/__init__.py package marker
- Create lightsync/audio/engine.py with MPVEngine class
  - Headless mpv wrapper (vo=null, ao from MPV_AO env var default null)
  - 10Hz polling loop in daemon thread (time.sleep(0.1), not observe_property)
  - Thread-safe get_state() returning position, paused, duration, loaded, file
  - load/play/pause/seek/stop methods (AUD-01, AUD-03)
  - apply_timer_fix() with sys.platform == win32 guard (INF-03)
- Update main.py lifespan to create/start/stop MPVEngine
  - MPV_AO env var controls audio output (default null for server mode)
  - engine exposed via app.state.engine for API routes
2026-04-06 13:03:43 +00:00
Claude
474b4a71d5 chore(02-01): add audio dependencies to Dockerfile and pyproject.toml
- Add mpv-libs, ffmpeg, ffmpeg-libs, libsndfile to Alpine Dockerfile
- Add python-mpv>=1.0.5, soundfile>=0.12.0, numpy>=1.26.0 to pyproject.toml
2026-04-06 13:02:41 +00:00
Claude
4af7f4de5f docs(02): research and plans for audio engine phase 2026-04-06 12:45:09 +00:00
Claude
f8d60cc0e0 docs(02): create phase 02 audio engine plans (3 plans, 3 waves) 2026-04-06 12:44:41 +00:00
Claude
d61c32a75b docs(02): research audio engine phase — MPV, soundfile, waveform, WebSocket broadcast 2026-04-06 12:36:51 +00:00
Claude
a8db2a4ce7 docs(01): mark verification passed — user confirmed device CRUD works 2026-04-06 12:24:26 +00:00
Claude
7590fc309d fix(ws): use wss:// on HTTPS to prevent mixed content SecurityError blocking module execution 2026-04-06 12:23:05 +00:00