feat(06-02): add feature extraction and segmentation backend modules + API

- Create lightsync/audio/features.py with extract_features and extract_features_async
- Create lightsync/audio/segments.py with detect_segments via agglomerative clustering
- Add /api/audio/segments and /api/audio/features endpoints to audio.py
- Initialize app.state.segments cache in main.py lifespan
This commit is contained in:
Claude
2026-04-07 11:40:29 +00:00
parent 8c1f0a0fbc
commit d339ba588d
4 changed files with 185 additions and 0 deletions

View File

@@ -25,6 +25,8 @@ async def lifespan(app: FastAPI):
# Beat analysis cache: filepath -> {"tempo": float, "beats": [float, ...]}
app.state.beats = {}
# Segments cache: "filepath:n_segments" -> [{start, end, label}, ...]
app.state.segments = {}
# UDP sender for device communication (Phase 3)
udp_sender = UDPSender()