All Projects → JeffreyCA → Spleeter Web

JeffreyCA / Spleeter Web

Licence: mit
Self-hostable web app for isolating the vocal, accompaniment, bass, and drums of any song. Powered by Spleeter, Demucs, Tasnet, X-UMX. Built with React and Django.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Spleeter Web

Django Blog Python Learning
For newest version https://github.com/agusmakmun/python.web.id
Stars: ✭ 77 (-6.1%)
Mutual labels:  django
Ayudapy
Platform to help people help people
Stars: ✭ 79 (-3.66%)
Mutual labels:  django
Django Notifications
GitHub notifications alike app for Django
Stars: ✭ 1,237 (+1408.54%)
Mutual labels:  django
Codingwithmitchblog Rest Api
A continuation of the CodingWithMitchBlog course. Adding a REST API using Django REST-framework
Stars: ✭ 78 (-4.88%)
Mutual labels:  django
Django Storage Swift
OpenStack Swift storage backend for Django
Stars: ✭ 78 (-4.88%)
Mutual labels:  django
Django Poll App
Django poll app is a full featured polling app. You have to register in this app to show the polls and to vote. If you already voted you can not vote again. Only the owner of a poll can add poll , edit poll, update poll, delete poll , add choice, update choice, delete choice and end a poll. If a poll is ended it can not be voted. Ended poll only shows user the final result of the poll. There is a search option for polls. Also user can filter polls by name, publish date, and by number of voted. Pagination will work even after applying filter.
Stars: ✭ 78 (-4.88%)
Mutual labels:  django
Django Amazon Ses
A Django email backend that uses Boto3 to interact with Amazon Simple Email Service (SES).
Stars: ✭ 77 (-6.1%)
Mutual labels:  django
Drf Autodocs
Ultimately automated DRF documentation rendering(UNMAINTAINED)
Stars: ✭ 82 (+0%)
Mutual labels:  django
Nuxx
Visual Docker composer for faster development. Discover, leverage, and launch community recipes.
Stars: ✭ 79 (-3.66%)
Mutual labels:  django
Django Crash Starter
The Cookiecutter template for the Django Crash Course tutorial by Daniel and Audrey Feldroy.
Stars: ✭ 80 (-2.44%)
Mutual labels:  django
The Complete Guide To Drf And Vuejs
📢 Source Code from my Web Dev Course *The Complete Guide To Django REST Framework and Vue JS* (Lang: English & Italian)
Stars: ✭ 78 (-4.88%)
Mutual labels:  django
Postmarker
Python client library for Postmark API
Stars: ✭ 79 (-3.66%)
Mutual labels:  django
Djongo
Django and MongoDB database connector
Stars: ✭ 1,222 (+1390.24%)
Mutual labels:  django
Crispy Forms Foundation
Django application to add 'django-crispy-forms' layout objects for Foundation
Stars: ✭ 77 (-6.1%)
Mutual labels:  django
Asvs
A simple web app that helps developers understand the ASVS requirements.
Stars: ✭ 80 (-2.44%)
Mutual labels:  django
Generator Django Rest
Yeoman generator for a Django REST/GraphQL API, an optional React SPA & lots more!
Stars: ✭ 77 (-6.1%)
Mutual labels:  django
Education Backend
Django backend for my info-business website
Stars: ✭ 79 (-3.66%)
Mutual labels:  django
Pets
Pets is a Django-based website that allows people to share photos and information about missing pets and pets available for adoption
Stars: ✭ 82 (+0%)
Mutual labels:  django
Archer
基于inception的自动化SQL操作平台,支持SQL执行、LDAP认证、发邮件、OSC、SQL查询、SQL优化建议、权限管理等功能,支持docker镜像
Stars: ✭ 1,239 (+1410.98%)
Mutual labels:  django
Django Rest Framework Msgpack
MessagePack support for Django REST framework
Stars: ✭ 78 (-4.88%)
Mutual labels:  django

Spleeter Web

Latest release Commits since latest release Docker Compose push

Spleeter Web is a web application for isolating or removing the vocal, accompaniment, bass, and/or drum components of any song. For example, you can use it to isolate the vocals of a track, or you can use it remove the vocals to get an instrumental version of a song.

It supports a number of different source separation models: Spleeter (4stems-model), Demucs, Tasnet, and CrossNet-Open-Unmix.

The app uses Django for the backend API and React for the frontend. Celery is used for the task queue. Docker images are available, including ones with GPU support.

Table of Contents

Features

  • Supports Spleeter, Demucs, Tasnet, and CrossNet-Open-Unmix (X-UMX) source separation models
    • Each model supports a different set of user-configurable parameters in the UI
  • Dynamic Mixes lets you control the outputs of each component while playing back the track in real-time
  • Import tracks by uploading a file (MP3, FLAC, WAV) or by YouTube link
    • Built-in YouTube search functionality (YouTube Data API key required)
  • Persistent audio library with ability to stream and download your source tracks and mixes
  • Customize number of background workers working on audio separation and YouTube imports
  • Supports third-party storage backends like S3 and Azure Blob Storage
  • Clean and responsive UI
  • Support for GPU separation
  • Fully Dockerized

Demo site

Homepage

Upload modal

Mixer

Getting started with Docker

Requirements

Instructions

  1. Clone repo:

    $ git clone https://github.com/JeffreyCA/spleeter-web.git
    $ cd spleeter-web
    
  2. (Optional) Set the YouTube Data API key (for YouTube search functionality):

    You can skip this step, but you would not be able to import songs by searching with a query. You would still be able to import songs via YouTube links though.

    Create an .env file at the project root with the following contents:

    YOUTUBE_API_KEY=<YouTube Data API key>
    
  3. (Optional) Setup for GPU support: Source separation can be accelerated with a GPU (however only NVIDIA GPUs are supported).

    1. Install NVIDIA drivers for your GPU.

    2. Install the NVIDIA Container Toolkit.

    3. Verify Docker works with your GPU by running sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi

  4. Download and run prebuilt Docker images:

    # For regular CPU separation
    spleeter-web$ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
    # For GPU separation
    spleeter-web$ docker-compose -f docker-compose.gpu.yml -f docker-compose.dev.yml up
    

    Alternatively, you can build the Docker images from source:

    # For regular CPU separation
    spleeter-web$ docker-compose -f docker-compose.yml -f docker-compose.build.yml -f docker-compose.dev.yml up --build
    # For GPU separation
    spleeter-web$ docker-compose -f docker-compose.gpu.yml -f docker-compose.build.gpu.yml -f docker-compose.dev.yml up --build
    
  5. Launch Spleeter Web

    Navigate to http://127.0.0.1:8000 in your browser. Uploaded tracks and generated mixes will appear in media/uploads and media/separate respectively on your host machine.

Getting started without Docker

If you are on Windows, it's recommended to follow the Docker instructions above. Celery is not well-supported on Windows.

Requirements

  • 4 GB+ of memory (source separation is memory-intensive)
  • Python 3.6+ (link)
  • Node.js 12+ (link)
  • Redis (link)
  • ffmpeg and ffprobe (link)
    • On macOS, you can install using Homebrew or MacPorts
    • On Windows, you can follow this guide

Instructions

  1. Set environment variables

    Make sure these variables are set when running all subsequent commands.

    # Unix/macOS:
    (env) spleeter-web$ export DJANGO_DEVELOPMENT=true
    (env) spleeter-web$ export YOUTUBE_API_KEY=<api key>
    # Windows:
    (env) spleeter-web$ set DJANGO_DEVELOPMENT=true
    (env) spleeter-web$ set YOUTUBE_API_KEY=<api key>
    
  2. Create Python virtual environment

    spleeter-web$ python -m venv env
    # Unix/macOS:
    spleeter-web$ source env/bin/activate
    # Windows:
    spleeter-web$ .\env\Scripts\activate
    
  3. Install Python dependencies

    (env) spleeter-web$ pip install -r requirements.txt
    
  4. Install Node dependencies

    spleeter-web$ cd frontend
    spleeter-web/frontend$ npm install
    
  5. Ensure Redis server is running on localhost:6379 (needed for Celery)

    You can run it on a different host or port, but make sure to update CELERY_BROKER_URL and CELERY_RESULT_BACKEND in settings.py. It must be follow the format: redis://host:port/db.

  6. Apply migrations

    (env) spleeter-web$ python manage.py migrate
    
  7. Start frontend

    spleeter-web$ npm run dev --prefix frontend
    
  8. Start backend in separate terminal

    (env) spleeter-web$ python manage.py runserver 0.0.0.0:8000
    
  9. Start Celery workers in separate terminal

    Unix/macOS:

    # Start fast worker
    (env) spleeter-web$ celery -A api worker -l INFO -Q fast_queue -c 3
    
    # Start slow worker
    (env) spleeter-web$ celery -A api worker -l INFO -Q slow_queue -c 1
    

    This launches two Celery workers: one processes fast tasks like YouTube imports and the other processes slow tasks like source separation. The one working on fast tasks can work on 3 tasks concurrently, while the one working on slow tasks only handles a single task at a time (since it's resource-intensive). Feel free to adjust these values to your fitting.

    Windows:

    You'll first need to install gevent. Note however that you will not be able to abort in-progress tasks if using Celery on Windows.

    (env) spleeter-web$ pip install gevent
    
    # Start fast worker
    (env) spleeter-web$ celery -A api worker -l INFO -Q fast_queue -c 3 --pool=gevent
    
    # Start slow worker
    (env) spleeter-web$ celery -A api worker -l INFO -Q slow_queue -c 1 --pool=gevent
    
  10. Launch Spleeter Web

    Navigate to http://127.0.0.1:8000 in your browser. Uploaded and mixed tracks will appear in media/uploads and media/separate respectively.

Configuration

Django settings

Settings file Description
django_react/settings.py The base Django settings used when launched in non-Docker context.
django_react/settings_dev.py Contains the override settings used when run in development mode (i.e. DJANGO_DEVELOPMENT is set).
django_react/settings_docker.py The base Django settings used when launched using Docker.
django_react/settings_docker_dev.py Contains the override settings used when run in development mode using Docker (i.e. docker-compose.dev.yml).

Environment variables

Name Description
CPU_SEPARATION No need to set this if using Docker. Otherwise, set to 1 if you want CPU separation and 0 if you want GPU separation.
DJANGO_DEVELOPMENT Set to true if you want to run development build, which uses settings_dev.py/settings_docker_dev.py and runs Webpack in dev mode.
APP_HOST Domain name or public IP of server. This is only used for production builds (i.e. when DJANGO_DEVELOPMENT is not set)
AWS_ACCESS_KEY_ID AWS access key. Used when DEFAULT_FILE_STORAGE in settings*.py is set to api.storage.S3Boto3Storage.
AWS_SECRET_ACCESS_KEY AWS secret access key. Used when DEFAULT_FILE_STORAGE in settings*.py is set to api.storage.S3Boto3Storage.
AWS_STORAGE_BUCKET_NAME AWS S3 storage bucket name. Used when DEFAULT_FILE_STORAGE in settings*.py is set to api.storage.S3Boto3Storage.
AWS_S3_CUSTOM_DOMAIN Custom domain, such as for a CDN. Used when DEFAULT_FILE_STORAGE in settings*.py is set to api.storage.S3Boto3Storage.
AZURE_ACCOUNT_KEY Azure Blob account key. Used when DEFAULT_FILE_STORAGE in settings*.py is set to api.storage.AzureStorage.
AZURE_ACCOUNT_NAME Azure Blob account name. Used when DEFAULT_FILE_STORAGE in settings*.py is set to api.storage.AzureStorage.
AZURE_CONTAINER Azure Blob container name. Used when DEFAULT_FILE_STORAGE in settings*.py is set to api.storage.AzureStorage.
AZURE_CUSTOM_DOMAIN Custom domain, such as for a CDN. Used when DEFAULT_FILE_STORAGE in settings*.py is set to api.storage.AzureStorage.
CELERY_BROKER_URL Broker URL for Celery (e.g. redis://localhost:6379/0).
CELERY_RESULT_BACKEND Result backend for Celery (e.g. redis://localhost:6379/0).
CELERY_FAST_QUEUE_CONCURRENCY Number of concurrent YouTube import tasks Celery can process (used only if run using Docker).
CELERY_SLOW_QUEUE_CONCURRENCY Number of concurrent source separation tasks Celery can process (used only if run using Docker).
YOUTUBE_API_KEY YouTube Data API key.

Using cloud storage (Azure Storage, AWS S3, etc.)

By default, Spleeter Web uses the local filesystem to store uploaded files and mixes. It uses django-storages, so you can also configure it to use other storage backends like Azure Storage or AWS S3.

To do this, edit django_react/settings_docker.py (if using Docker) or django_react/settings.py and set DEFAULT_FILE_STORAGE to another backend like api.storage.S3Boto3Storage or api.storage.AzureStorage.

Then, set the following environment variables (.env if using Docker), depending on which backend you're using:

S3:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_STORAGE_BUCKET_NAME

Azure:

  • AZURE_ACCOUNT_KEY
  • AZURE_ACCOUNT_NAME
  • AZURE_CONTAINER

CORS

To play back a dynamic mix, you may need to configure your storage service's CORS settings to allow the Access-Control-Allow-Origin header.

Deployment

Spleeter Web can be deployed on a VPS or a cloud server such as Azure VMs, AWS EC2, DigitalOcean, etc. Deploying to cloud container services like ECS is not yet supported out of the box.

  1. Clone this git repo

    $ git clone https://github.com/JeffreyCA/spleeter-web.git
    $ cd spleeter-web
    
  2. If you want your server to self-host the media files instead of using a cloud storage provider, then first edit django_react/settings_docker.py and uncomment this line:

    DEFAULT_FILE_STORAGE = 'api.storage.FileSystemStorage'
    

    Next, update docker-compose.prod.selfhost.yml and replace /path/to/media with the path where media files should be stored on the server.

  3. In spleeter-web, create an .env file with the production environment variables

    .env file:

    APP_HOST=<domain name or public IP of server>
    AWS_ACCESS_KEY_ID=<access key id>                 # Optional
    AWS_SECRET_ACCESS_KEY=<secret key>                # Optional
    AWS_STORAGE_BUCKET_NAME=<bucket name>             # Optional
    AWS_S3_CUSTOM_DOMAIN=<custom domain>              # Optional
    AZURE_ACCOUNT_KEY=<account key>                   # Optional
    AZURE_ACCOUNT_NAME=<account name>                 # Optional
    AZURE_CONTAINER=<container name>                  # Optional
    AZURE_CUSTOM_DOMAIN=<custom domain>               # Optional
    CELERY_FAST_QUEUE_CONCURRENCY=<concurrency count> # Optional (default = 3)
    CELERY_SLOW_QUEUE_CONCURRENCY=<concurrency count> # Optional (default = 1)
    YOUTUBE_API_KEY=<youtube api key>                 # Optional
    

    These values are referenced in django_react/settings_docker.py and docker-compose.yml, so you can also edit those files directly to set your production settings.

  4. Build and start production containers

    To enable GPU separation, substitute docker-compose.yml and docker-compose.build.yml for docker-compose.gpu.yml and docker-compose.build.gpu.yml below respectively.

    If you are self-hosting media files:

    # Use prebuilt images
    spleeter-web$ sudo docker-compose -f docker-compose.yml -f docker-compose.prod.yml -f docker-compose.prod.selfhost.yml up -d
    # Or build from source
    spleeter-web$ sudo docker-compose -f docker-compose.yml -f docker-compose.build.yml -f docker-compose.prod.yml -f docker-compose.prod.selfhost.yml up --build -d
    

    Otherwise if using a storage provider:

    # Use prebuilt images
    spleeter-web$ sudo docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
    # Or build from source
    spleeter-web$ sudo docker-compose -f docker-compose.yml -f docker-compose.build.yml -f docker-compose.prod.yml up --build -d
    
  5. Access Spleeter Web at whatever you set APP_HOST to. Note that it will be running on port 80, not 8000.

Common issues & FAQs

Credits

Special thanks to:

Turntable icon made from Icon Fonts is licensed by CC BY 3.0.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].