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:
- Extract vocals from the audio files found in
/path/to/your/audio/files. - Save the vocals in the
/path/to/output/folderdirectory, 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
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 demucs_acapella-1.0.3.tar.gz.
File metadata
- Download URL: demucs_acapella-1.0.3.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccaec0abe849972d0e55427d913ab90056491c575239dd746e13d2d94733687c
|
|
| MD5 |
c5366d34a894b4210de8e763c5ca0345
|
|
| BLAKE2b-256 |
c11d394d00ca4f3c2baa4ea33aa83d112ecc72a97662dacd597ed8940289df89
|
File details
Details for the file demucs_acapella-1.0.3-py3-none-any.whl.
File metadata
- Download URL: demucs_acapella-1.0.3-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5606aac0245b2a2bb84e6cc3fbc63a5f2b933e7cf52cda284859ff2387adf3c0
|
|
| MD5 |
f3d1a65ae0c3a2172d4dc166e073efd7
|
|
| BLAKE2b-256 |
67296f4515bf8b8a4b6e1fe548aff038e5efbb6fc07837be82d5db25ff373f9d
|