Separate audio into stems (vocals, instruments) using AI-powered Spleeter
Project description
demix
separates audio from songs into stems (vocals, instruments), transpose music, change tempo, operates on music from youtube video or local file
prerequisites
[!NOTE] Please note: I'm using homebrew for installing
virtualenvwrapperandffmpeg. If you're using another package manager or different operating system than macOS (e.g. Linux), you need to install it differently. In the setup below I also defined separate virtualenvs for user installationdemix-cliand for developmentdemix. It's important to keep them separated if you want to use the app in two modes. If you want to use one mode only, it doesn't really matter as well as the name of the virtualenv. In the examples for creating virtualenv below, replace python path below with your own python3.8 path. I'm personally using pyenv for installing various python verions, but you can do it as you wish.
installation
I suggest to create virtualenv for this project to not break existing system-wide installations:
brew install virtualenvwrapper
brew install ffmpeg
mkdir demix-cli
cd demix-cli
mkvirtualenv -p /Users/pw/.pyenv/versions/3.8.16/bin/python demix-cli
workon demix-cli
pip install demix
demix -v
update
pip install demix --upgrade
development
prepare environment:
brew install virtualenvwrapper
brew install ffmpeg
git clone git@github.com:pwittchen/demix.git
cd demix
mkvirtualenv -p /Users/pw/.pyenv/versions/3.8.16/bin/python demix
workon demix
pip install -r requirements.txt
python demix.py -v
virtualenv
exit virtualenv, when you're done:
deactivate
to activate env again:
for user installation:
workon demix-cli
for dev setup:
workon demix
[!TIP] You can change local names of these envs if you want to.
testing
install pytest:
pip install pytest
run all tests (-v param for verbose):
pytest -v
versioning
bump version in pyproject.toml and src/demix/__init__.py:
python bump_version.py 1.0.4
use --dry-run to preview changes without applying them:
python bump_version.py 1.0.4 --dry-run
after setting the version, create git tag with appropriate name, .e.g. v1.0.4 and push it to the repo
usage
demix -u <youtube-url> [options]
demix -s <search-query> [options]
demix -f <audio-file> [options]
options
| Option | Description |
|---|---|
-u, --url |
YouTube video URL to process |
-s, --search |
Search YouTube for a song (e.g., 'Artist - Song Name') |
-f, --file |
Local audio file to process (mp3, wav, flac, etc.) |
-o, --output |
Output directory (default: output) |
-t, --tempo |
Tempo factor for output audio (default: 1.0, use < 1.0 to slow down) |
-p, --transpose |
Transpose pitch by semitones (default: 0, range: -12 to +12) |
-ss, --start |
Start time for cutting (format: MM:SS or HH:MM:SS) |
-to, --end |
End time for cutting (format: MM:SS or HH:MM:SS) |
-m, --mode |
Separation mode: 2stems, 4stems, or 5stems (default: 2stems) |
-c, --clean |
Clean up files: output, models, or all |
-v, --version |
Show version number |
-h, --help |
Show help message |
separation modes
| Mode | Stems |
|---|---|
2stems |
vocals, accompaniment |
4stems |
vocals, drums, bass, other |
5stems |
vocals, drums, bass, piano, other |
examples
# separate a YouTube video into vocals and accompaniment
demix -u 'https://www.youtube.com/watch?v=VIDEO_ID'
# search YouTube by artist and song name
demix -s 'Queen - Bohemian Rhapsody' -m 4stems
# separate a local file with 4 stems
demix -f /path/to/song.mp3 -m 4stems
# cut audio from 1:30 to 3:45 before separation
demix -f song.mp3 -ss 1:30 -to 3:45
# start from 0:30 (skip intro)
demix -f song.mp3 -ss 0:30
# keep only the first 2 minutes
demix -f song.mp3 -to 2:00
# combine cutting with tempo and transpose
demix -f song.mp3 -ss 1:00 -to 4:00 -t 0.8 -p -2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file demix-1.1.0.tar.gz.
File metadata
- Download URL: demix-1.1.0.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91779b94cb2eb1c2a608d0340f5770dd45df9f68614d9a6367586afa0811b996
|
|
| MD5 |
3b706a5b55485939d4e297a7e1d94269
|
|
| BLAKE2b-256 |
a3f51e309583bffbbe5ec63447bac602fa1cd5686bea5f4e0ba78e57734bb7de
|
File details
Details for the file demix-1.1.0-py3-none-any.whl.
File metadata
- Download URL: demix-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c997d3be9bb9cb32da098dc36315787ed35488964e21617ca7274fee745827c
|
|
| MD5 |
9f4159528107e26aceaa287060b9cfa2
|
|
| BLAKE2b-256 |
902b998be1cae9fbbc16038b934c13bcac14fc00c261207cc336cf2ebb811a08
|