feat: BPM and musical key detection for all clips
Backend:
- New analysis.py module using librosa for BPM + key detection
- detect_bpm(): librosa.beat.beat_track() returns tempo
- detect_key(): Krumhansl-Schmuckler key profiles on chroma features
- analyze_clip(): combined call returning {bpm, key}
- New dependency: librosa==0.10.2 + soundfile==0.12.1
- Database migrations: bpm (REAL) and key (TEXT) columns added
- New set_analysis() function in database.py
- New endpoint: GET /api/clips/{id}/analysis
- Returns cached analysis if available
- Computes on-demand if missing, caches result
- 400 if clip not ready, 404 if no audio file
Frontend:
- Clip interface extended with bpm?: number | null, key?: string | null
- Gallery: BPM and key badges shown in ribbon and tile views
- BPM badge: lyria-accent background
- Key badge: white/5 background
- DetailPanel: BPM and key shown in metadata grid when available
- App.tsx: handleSelectClip() fetches analysis on-demand when opening
detail panel if not already cached
Docs:
- Architecture KB updated with Audio Analysis section
- Tasks KB: T-028 marked In Progress → will mark Done after commit
This commit is contained in:
1 parent
2d47f77820
commit
1e21b7dcc8
7 files changed
+187
-3
No files matched your search
@@ -6,3 +6,5 @@ pydantic>=2.10.0
|
||||
python-multipart==0.0.12
|
||||
python-dotenv==1.0.0
|
||||
numpy==2.2.0
|
||||
librosa==0.10.2
|
||||
soundfile==0.12.1
|
||||
Reference in new issue
Block a user