CD 2023 Project

Here we have a sample code that loads one mp3 file and splits it into 4 tracks: vocals, drums, bass and other.

The codes uses one library named demucs, this library uses a deep learning model to separate the tracks. This library requires ffmpeg to work. It should be present in most Linux distributions.

Dependencies

For Ubuntu (and other debian based linux), run the following commands:

sudo apt install ffmpeg

Setup

Run the following commands to setup the environement:

mkdir tracks

python3 -m venv venv
source venv/bin/activate

pip install pip --upgrade
pip install -r requirements_torch.txt
pip install -r requirements_demucs.txt

It is important to install the requirements following the previous instructions. By default, PyTorch will install the CUDA version of the library (over 4G simple from the virtual environment). As such, the current instructions force the installation of the CPU version of PyTorch and then installs Demucs.

Usage

The sample main code only requires two parameters:

  • i the mp3 file used for input
  • o the folder for the output

Two audio tracks are given (download them from here):

  • test.mp3 a short sample (0:34) that allows for a quick validation
  • mudic.mp3 a long (59:04) sequence of royalty free rock musics that are the target of the work

Both audio files are royalty free.

To run test the sample code simple run:

python main.py -i test.mp3

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.