Analyze & progress
How library analysis and stem generation report progress: the job split, TrackProgress phases, and pad flags.
Library analysis (BPM/key/loudness/waveform) and stem ensure are separate jobs. Analyzing… can finish when analysis finishes while stems continue independently. Both emit progress (phase + optional fraction) instead of a silent loader.
The two jobs decode independently. Analysis decodes the file itself, persists its results, and emits TrackAnalyzed. Stem ensure decodes the track through the playback decode cache, runs the model, and muxes a cache. A stem failure leaves the analysis results intact.
Job split
| Topic | Choice |
|---|---|
| Analyze vs stems | Separate jobs; TrackAnalyzed after analysis persist only |
| Stem failure | Does not undo BPM/key; EvtBody::Error with clear message |
| Parallelism | Analysis on the library worker thread, stem ensure on the serial stems thread; existing Demucs mutex stays |
| Progress | EvtBody::TrackProgress { track_id, phase, fraction } on library evt bus |
| Pad banner | stemsGenerating true only between stem-job start and ready/failed |
| Disk full | Map ENOSPC / quota / “No space” → “Stem cache write failed: disk full” (toast via existing error path) |
Progress phases
| Phase | Job | Notes |
|---|---|---|
decode |
stems | Loading PCM for the stem job |
bpm / key / loudness / waveform |
analysis | Emit as each step starts (or completes); fraction optional |
stems_model |
stems | Model ensure / download |
stems_separate |
stems | Demucs windows; fraction = windows done / total |
stems_encode |
stems | Mux .stem.mp4; fraction optional |
stems_ready |
stems | Terminal success |
stems_failed |
stems | Terminal failure (also emit Error) |
The library row and the detail panel show a short phase label, plus a percentage when a fraction is present. Analyzing… clears on TrackAnalyzed or an analysis Error only.
Pad and deck flags
- Deck
UpdatedauthorsstemsReadyandstemsGenerating. - Banner iff
stemsGenerating; pads live iffstemsReady; else disabled, no banner (idle / failed / stems off).
Analyze worker flow (no stems)
decode PCM (progress: decode)
│
└── bpm/key/loudness/waveform → persist → TrackAnalyzed
Analyze never generates stems: they are expensive (a full Demucs pass) and are opt-in per track.
GenerateStems worker flow
decode PCM (progress: decode)
│
└── model → separate → mux .stem.mp4 → upsert
├── success: stems_ready
└── failure: stems_failed + Error (disk full mapped)
Fired by the per-track GenerateStems action; no-op when a valid cache already exists. Runs on its own stems-ensure-{track_id} thread, so it never blocks analyze or playback.
Stem ensure runs from the GenerateStems action only, never on deck load. Deck load reads an existing cache and otherwise plays the original (NI .stem.mp4).