Skip to main content

Separate audio into stems (vocals, instruments) using AI-powered Spleeter

Project description

demix

separates audio from songs into stems (vocals, instruments)

development

prepare environment (replace python path below with your own python3.8 path):

brew install virtualenvwrapper
brew install ffmpeg
mkvirtualenv -p /Users/pw/.pyenv/versions/3.8.16/bin/python demix
workon demix
pip install -r requirements.txt

Please note: I'm using homebrew for installing virtualenvwrapper and ffmpeg. If you're using another package manager or different operating system than macOS (e.g. Linux), you need to install it differently.

exit virtualenv, when you're done:

deactivate

to activate env again:

workon demix

testing

install pytest:

pip install pytest

run all tests (-v param for verbose):

pytest -v

usage

python demix.py -u <youtube-url> [options]
python demix.py -f <audio-file> [options]

options

Option Description
-u, --url YouTube video URL to process
-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
python demix.py -u 'https://www.youtube.com/watch?v=VIDEO_ID'

# separate a local file with 4 stems
python demix.py -f /path/to/song.mp3 -m 4stems

# cut audio from 1:30 to 3:45 before separation
python demix.py -f song.mp3 -ss 1:30 -to 3:45

# start from 0:30 (skip intro)
python demix.py -f song.mp3 -ss 0:30

# keep only the first 2 minutes
python demix.py -f song.mp3 -to 2:00

# combine cutting with tempo and transpose
python demix.py -f song.mp3 -ss 1:00 -to 4:00 -t 0.8 -p -2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

demix-1.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

demix-1.0.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file demix-1.0.0.tar.gz.

File metadata

  • Download URL: demix-1.0.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for demix-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cb06c6ac489ada4ad5e407e7d6da50091d52f78d353b4986ebaca2de67927f95
MD5 a1f5ef1cd09d5b9fb9d9fe39c546d6cd
BLAKE2b-256 2dde73106dc37e8d09fc161a746ae24f3129ef3cb4581bf5f6bb8bdda815973e

See more details on using hashes here.

File details

Details for the file demix-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: demix-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for demix-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe8538ac88cc98900afcf1d4542d71c09e4bf0396257ec5cd1bd89c48d2ec490
MD5 8615c83c2d3fc4a400a573235013037b
BLAKE2b-256 5338a4f381408f1e959aab36deb52649195bf39293bfbb3742ebb92450b45ba6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page