Skip to main content

A CLI tool for extracting acapellas using Demucs and managing audio metadata.

Project description

Demucs Acapella

demucs_acapella is a Python package that extracts vocals (acapella) from audio files using the Demucs model and embeds the key and BPM into the metadata of the output files.

Features

  • Extracts vocals (acapella) from audio files.
  • Automatically embeds the detected key and BPM into the metadata of the output files.
  • Supports various audio formats including .mp3, .wav, and .flac.
  • Can be used from the command line or as a Python package.

Installation

From PyPI

You can install the demucs_acapella package directly from PyPI:

pip install demucs_acapella

From Source

To install from source, clone the repository and install the dependencies:

git clone https://github.com/yourusername/demucs_acapella.git
cd demucs_acapella
pip install -r requirements.txt

Dependencies

  • demucs: For the deep learning model to extract vocals.
  • pydub: For audio file manipulation.
  • tinytag: For extracting BPM from audio files.
  • eyed3: For modifying MP3 metadata.

You can install the necessary dependencies by running:

pip install -r requirements.txt

Usage

Command Line Interface (CLI)

To run the package and extract vocals from your audio files, use the following command:

demucs_acapella -i /path/to/input/folder -o /path/to/output/folder

Arguments

  • -i, --input: Path to the input directory containing audio files. It will recursively search for audio files.
  • -o, --output: Path to the output directory where acapella files will be stored.

Example

demucs_acapella -i /path/to/your/audio/files -o /path/to/output/folder

This will:

  1. Extract vocals from the audio files found in /path/to/your/audio/files.
  2. Save the vocals in the /path/to/output/folder directory, preserving the original folder structure.

Embedding Key and BPM Metadata

After the vocals are extracted, the script can automatically embed the key and BPM information into the metadata of the output files.

Running from Python Script

You can also use the package programmatically in your Python code:

from demucs_acapella import extract_vocals

input_file = '/path/to/audio/file.mp3'
output_folder = '/path/to/output/folder'
vocals_file = extract_vocals(input_file, output_folder)

if vocals_file:
    print(f"Extracted vocals saved to {vocals_file}")
else:
    print("Failed to extract vocals.")

Examples

Example 1: CLI extraction

Run the following command to extract acapella from an entire folder of audio files:

demucs_acapella -i /path/to/input/folder -o /path/to/output/folder

This will process all supported audio files (such as .mp3, .wav, and .flac) inside the input folder and save the extracted acapella versions in the output folder.

Example 2: Programmatic Usage

You can call extract_vocals from your Python script to extract vocals for a specific audio file:

from demucs_acapella import extract_vocals

vocals_file = extract_vocals('path/to/input/file.mp3', 'path/to/output/folder')
if vocals_file:
    print(f"Vocals saved to {vocals_file}")
else:
    print("Error extracting vocals.")

License

demucs_acapella is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgements

  • Demucs for the deep learning model to separate vocals.
  • pydub for audio file manipulation.
  • eyed3 for modifying MP3 metadata.

Contributing

Feel free to open an issue or submit a pull request if you'd like to contribute to this project.

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

demucs_acapella-1.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

demucs_acapella-1.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file demucs_acapella-1.0.1.tar.gz.

File metadata

  • Download URL: demucs_acapella-1.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for demucs_acapella-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8cce59d6f605d3ef3001f1c787c1bad0ae6e9406fd8a50da25081d19964a1656
MD5 6efc5135cabe1377a95e7d0ff6b7b049
BLAKE2b-256 ffb9056572ff15b56d182afc4d8c1997a8436ffc34e5e5827b99a80bfb2b9d35

See more details on using hashes here.

File details

Details for the file demucs_acapella-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for demucs_acapella-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfa7fcdfb1da33103b9a50a060cea6d5552b939b5ae3bc64de6fe5077e550c97
MD5 5a63f4420aa24b169c190eccf2fac78f
BLAKE2b-256 b09413db12ad4478ed40957376ac2df3d99210b475f0b76dd4cc4104e9a09cfb

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