Skip to content

About

πŸŽ› Stemgen is a Stem file generator. Convert any track into a Stem and have fun with Traktor.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Β 
Β 

Latest commit

Β 

History

131 Commits

Folders and files

Repository files navigation

StemGen

Turn any track into a Native Instruments .stem.m4a. Pick a few audio files, and StemGen separates each one into drums, bass, other and vocals with Demucs, muxes the four stems plus the mixdown into a Stem file with GPAC, and carries the original tags and cover art across β€” ready for Traktor or any other Stems-capable player.

Runs on macOS and Windows, on your own machine. Nothing is uploaded anywhere.

This is a fork of axeldelafosse/stemgen with a small Qt front end around it.


What it does

  • Separates β€” htdemucs (Hybrid Transformer Demucs), on the GPU when there is one (CUDA or Apple MPS), otherwise on the CPU.
  • Keeps your quality β€” 24-bit sources stay 24-bit; 32-bit is brought down to 24; everything is resampled to 44.1 kHz with SoX's very-high-quality resampler because that is what the model was trained on.
  • Writes real Stem files β€” ALAC-encoded stems, the stem-meta atom with the standard four-colour layout, cover art and tags copied from the source.
  • Skips what is already done β€” a file that is already a .stem.m4a, or that has one next to it, is left alone.

Accepted input: .wav, .wave, .aif, .aiff, .flac, .mp3.


Install

Download the latest build from Releases:

macOS StemGen.dmg β€” drag to Applications.
Windows, NVIDIA GPU StemGenSetup-CUDA-….msi β€” splits on the GPU (RTX 20xx or newer). Large: it carries CUDA.
Windows, anything else StemGenSetup-….msi β€” splits on the CPU.

Both Windows installers are a normal Next/Next/Install wizard and replace each other, so switching is just installing the other one. The CUDA build also runs without a usable NVIDIA GPU β€” it falls back to the CPU β€” it is just a much bigger download for nothing.

The Demucs model weights (~80 MB) are downloaded on first run into your torch cache and reused afterwards.

What you need

OS macOS 13 or newer on Apple Silicon, or Windows 10/11 (64-bit).
Disk ~1.5 GB for the app (most of it is torch).

Nothing else to install: ffmpeg, ffprobe, SoX and mp4box (GPAC 26.07) are bundled, and the app uses its own copies even if you have others installed.

Intel Macs are not supported β€” PyTorch stopped publishing x86_64 macOS builds, so there is no torch for the app to ship there.


Using it

  1. Click Start and pick one or more tracks.
  2. Watch the counter β€” it shows which track is being prepared, split, saved and cleaned, and how many were processed, skipped or failed.
  3. The .stem.m4a lands next to the source file. The details pane at the bottom lists every processed track and any error at the end of the run.

The window has no title bar β€” drag it anywhere by its body, close it with the Γ— in the corner.


Build from source

Requires Python 3.13 (pinned β€” Nuitka's 3.14 support is not ready yet) and uv, which the Makefile bootstraps if it is not already on PATH. Only python3 is needed on a fresh clone. The bundled ffmpeg / ffprobe / SoX in AUDIO_mac/ / AUDIO_win/ are used from source too; on Linux, install ffmpeg and SoX yourself.

git clone https://github.com/hdavid/stemgen.git
cd stemgen

make venv      # create .venv with runtime + build + dev dependencies
make run       # run from source
make test      # unit tests

To build a distributable:

make build     # Nuitka compile β†’ dist/StemGen.app (Windows: dist/StemGenApp.dist/)
make package   # wrap it: .dmg on macOS, .msi on Windows
make deploy    # macOS: build + install into /Applications, replacing the old copy

On Windows use .\make.ps1 <target> β€” same names, same behaviour, except that uv has to be installed first (winget install --id=astral-sh.uv -e); there is no bootstrap fallback there. make help lists everything. .\make.ps1 package -Variant cuda builds the CUDA installer instead, from its own .venv-cuda / dist-cuda\ so the two torch builds never overwrite each other.

Signing is optional: with no DEVELOPER_ID_APP in .env.local the macOS build signs ad-hoc and still runs locally; copy .env.local.example to .env.local to sign with a Developer ID and notarize.

Tag a commit v* and the GitHub workflows under .github/workflows/ build the .dmg and the .msi and attach both to the release.

Layout

src/
  StemGenApp.py       entry point β€” the Qt window and worker thread
  stemgen.py          the pipeline: prepare β†’ Demucs β†’ Stem file β†’ clean up
  ni_stem.py          Stem file creation around GPAC's mp4box
  metadata.py         tag and cover-art extraction
  layout.py           generated by pyuic5 (imports switched to PySide6) β€” do not edit by hand
  runtime.py          dev-vs-bundle detection, bundled-data paths
GPAC_mac/ GPAC_win/   mp4box shipped inside the app (macOS: static universal build, see scripts/build_mp4box_macos.sh)
GPAC_linux/           (kept for running from source on Linux)
AUDIO_mac/ AUDIO_win/ static ffmpeg / ffprobe / SoX shipped inside the app (built by scripts/build_audio_tools.sh mac|win)
assets/               icon, .dmg background
scripts/              build (Nuitka), packaging (.dmg / .msi), signing
tests/unit/           headless β€” no Qt, no ffmpeg, no model download

Licence

MIT β€” see LICENSE. Demucs is MIT; GPAC is LGPL-2.1; PySide6 is LGPL-3.0. The bundled ffmpeg is LGPL-2.1 (built without GPL parts); SoX and libmad are GPL-2.0 and ship as separate executables. Their licences and exact source URLs are in AUDIO_mac/LICENSES/ and AUDIO_win/LICENSES/.

About

πŸŽ› Stemgen is a Stem file generator. Convert any track into a Stem and have fun with Traktor.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages