File size: 2,769 Bytes
bad77c5
093ff4b
 
 
 
bad77c5
 
 
093ff4b
bad77c5
093ff4b
 
bad77c5
 
093ff4b
 
 
ff0aee9
 
 
 
 
 
 
 
093ff4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
title: StemFlipper
emoji: 🎛️
colorFrom: purple
colorTo: blue
sdk: gradio
sdk_version: 6.19.0
app_file: app.py
python_version: "3.10.13"
pinned: false
license: mit
short_description: Song  stems  MIDI  editable instruments  DAW bundle
---

# 🎛️ StemFlipper

Upload a song → AI source-separation into stems → each stem becomes **transcribed MIDI +
a playable sliced-sample instrument (SFZ)** → download a **DAW project bundle**.

**Try it:** [live web app](https://andrewnakas.github.io/stemflipper/) ·
[Hugging Face Space](https://huggingface.co/spaces/nakas/stemflipper) ·
[parameter dataset](https://huggingface.co/datasets/nakas/stemflipper-dataset)

The web app in [`web/`](web/) is a static, build-step-free page that calls the Space's
API via `@gradio/client`; it is served from GitHub Pages. What the bundle contains:

```
song/
  stems/*.wav          separated stems (htdemucs)
  midi/song.mid        multitrack SMF Format 1 (tempo map) + per-stem .mid
  instruments/*/*.sfz  sliced-sample instruments (load in sfizz / Sforzando / DecentSampler)
  project.RPP          Reaper project with the stems arranged at the right tempo
  manifest.json        tempo, key, stem→file map
  README.txt           how to import into any DAW
```

## Run locally

```bash
python3.10 -m venv .venv && .venv/bin/pip install -r requirements.txt
.venv/bin/python -m stemflipper song.mp3 -o out/     # CLI
.venv/bin/python app.py                              # Gradio UI at :7860
.venv/bin/pytest -m "not slow"                       # tests
```

## Hardware notes

- **This Space runs on free CPU hardware** — separation of a 3–4 min song takes several
  minutes. The queue + progress bar handle it; just wait.
- **ZeroGPU upgrade path** (needs a PRO account): Space Settings → Hardware → ZeroGPU.
  The code is already compatible — `app.py` wraps only the separation stage in
  `@spaces.GPU(duration=180)`; everything else stays on CPU.

## Honest limitations (MVP)

- Transcription is an *editable starting point*, not a perfect score. Drums use an onset
  heuristic that misses overlapping hits.
- Sampler slices inherit any bleed/reverb baked into the separated stems.
- Separation weights (htdemucs) are trained on MUSDB18 (non-commercial training data) —
  this app is a **research/educational demo**, not a commercial service. See `PLAN.md`
  ("Licensing") for the retrain-before-monetization gate.

## Repo map

`stemflipper/` pipeline library (CLI: `python -m stemflipper`) · `app.py` Gradio adapter ·
`tests/` pytest suite with a deterministic synthetic test song · `PLAN.md` + `research/`
the research/architecture brief · `HANDOFF.md` build state, task queue, invariants ·
`dataset/`, `web/` upcoming (see HANDOFF.md).