Commit Graph

87 Commits

Author SHA1 Message Date
Claude
02826b2c89 docs(05): fix UI-SPEC checker blocks — typography, spacing 2026-04-07 09:05:57 +00:00
Claude
f739c8fe19 docs(05): UI design contract
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 09:02:33 +00:00
Claude
2ac23c3297 docs(05): research phase domain 2026-04-07 08:59:07 +00:00
Claude
7b37f014d0 docs(state): record phase 5 context session 2026-04-07 08:48:39 +00:00
Claude
4ce9759055 docs(05): capture phase context 2026-04-07 08:48:34 +00:00
Claude
34077018a9 docs(phase-04): evolve PROJECT.md after phase completion 2026-04-07 00:00:51 +00:00
Claude
399b7a1e05 docs(phase-04): complete phase execution 2026-04-07 00:00:33 +00:00
Claude
3483de871e docs(04-04): complete block inspector plan — SUMMARY, STATE, ROADMAP updated
- BlockInspector with color/speed/direction/length param controls
- UpdateParamsCommand for full undo/redo param editing
- Phase 04 complete (4/4 plans), TL-04 requirement marked done
- Progress: 14/14 plans (100%)
2026-04-06 23:56:25 +00:00
Claude
8e084ca8dc feat(04-04): wire BlockInspector into timeline and app.js
- app.js imports BlockInspector and DeleteBlockCommand
- Inspector created with #block-inspector element and timeline.history
- timeline._onSelectBlock callback shows/hides inspector on block select
- inspector._onDelete fires DeleteBlockCommand and hides inspector
- inspector.tracks kept in sync after loadTracks() resolves
- timeline.js block rendering uses blockColor + '1a' for color accent fill
- undo/redo handlers re-trigger _onSelectBlock to refresh inspector values
2026-04-06 23:54:22 +00:00
Claude
e82fc4a775 feat(04-04): add UpdateParamsCommand + BlockInspector module
- UpdateParamsCommand with execute/undo for color/speed/direction/length
- Uses module-level currentShowId (not this._showId) matching existing pattern
- BlockInspector renders compact strip with animation label, color swatch,
  speed input, direction select, length input, and remove button
- Color change committed on 'change' event (not 'input') to avoid command flood
- _onDelete callback wired to remove button for app.js to handle
2026-04-06 23:51:48 +00:00
Claude
d1965dcefc docs(04-03): complete BeatGrid plan summary and update state 2026-04-06 23:49:44 +00:00
Claude
287fe16a56 feat(04-03): BeatGrid module + enhanced beat rendering + loading states
- Create beats.js with BeatGrid class: load(), getCalibratedBeats(), getCalibratedOnsets(), snap(), hasBeats getter
- BeatGrid manages calibrationOffset and snapEnabled state
- snap() uses 100ms threshold against calibrated beat positions
- Handles API field variants: beats/beat_times, tempo/tempo_bpm
- Refactor timeline.js: replace beatTimes/calibrationOffset/snapEnabled with this.beatGrid
- Add getters/setters for calibrationOffset and snapEnabled (backward compat with app.js)
- render() now shows DETECTING BEATS... loading indicator and error state
- render() draws beat marks via getCalibratedBeats(), onset ticks via getCalibratedOnsets()
- snapToBeat() delegates to beatGrid.snap()
- app.js chains BPM label update after loadBeats() resolves
2026-04-06 23:48:27 +00:00
Claude
c37fa6d1f6 docs(04-02): complete block interactions plan — SUMMARY, STATE, ROADMAP updated
- CommandHistory + 4 command classes + backend CRUD endpoints
- Full mouse interactions: drag-place, move, resize, delete, undo/redo
- Requirements TL-02, TL-03, TL-06 marked complete
- Progress: 86% (12/14 plans)
2026-04-06 23:46:05 +00:00
Claude
7e18ac6c84 feat(04-02): wire block interactions into TimelineCanvas
- Import CommandHistory and all 4 command classes from new modules
- hitTest() with 8px EDGE for resize-left/resize-right/move zones
- _hasOverlap() check for time range collision on same track
- snapToBeat() with 0.1s threshold and calibrationOffset
- _setupInteractions() with mousedown/mousemove/keydown listeners
- _startMove(): live drag preview, snap on mouseup, overlap rejection
- _startResize(): left/right edge handles, 0.5s min duration, snap
- handleDrop(): place block from palette with crypto.randomUUID()
- Keyboard: Delete, Ctrl+Z (undo), Ctrl+Shift+Z / Ctrl+Y (redo)
- app.js: dragstart on palette, dragover/dragleave/drop on canvas
- Ghost block rendered during dragover for visual feedback
- Resize handle indicators drawn on selected block
2026-04-06 23:44:45 +00:00
Claude
658c92f94d feat(04-02): command pattern + CommandHistory + block CRUD backend
- CommandHistory class with execute/undo/redo, 50-step max, redo-clear on new action
- PlaceBlockCommand, MoveBlockCommand, ResizeBlockCommand, DeleteBlockCommand
- setCurrentShowId() module-level function for backend sync routing
- syncBlock() fire-and-forget fetch helper for backend sync
- POST/PATCH/DELETE /api/shows/{show_id}/tracks/{device_id}/blocks endpoints
- timeline router registered in main.py with prefix=/api
2026-04-06 23:37:29 +00:00
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