This project provides a convenient way to extract vocals from a song and generate a semi-accurate text transcription of the lyrics. It leverages the following tools:
- Demucs: A powerful deep learning-based source separation model for isolating vocals from music. (https://github.com/facebookresearch/demucs)
- AssemblyAI: An AI-powered transcription service. (https://www.assemblyai.com/)
- demucs: Install with
pip install demucs
. - ffmpeg: Install from your system's package manager or from https://ffmpeg.org/download.html
- AssemblyAI API Key:
- Sign up for a free AssemblyAI account.
- Obtain your API key from your AssemblyAI dashboard.
- Store your API key in a
.env
file in the project directory (see section below).
- Python libraries:
assemblyai
,dotenv
,os
,traceback
(install withpip install assemblyai dotenv
)
-
Open the
.env
file: Then input your api key:ASSEMBLYAI_API_KEY="YOUR_API"
Important: Make sure to replace
YOUR_API
with your actual API key. -
Install dependencies: Run the script in your terminal.
pip install demucs torch assemblyai dotenv
- Place the song file you want to process in the root directory of the project.
- Run the script from your terminal:
python main.py
- The script will prompt you to enter the full path to your song file.
- After processing:
- The isolated vocals will be saved as
data/vocals.wav
. - The generated lyrics will be saved as
data/lyrics.txt
.
- The isolated vocals will be saved as
- Transcription Accuracy: The provided transcription is a raw output and will likely contain errors. Manual cleanup, formatting, and editing will be required for optimal results.
- Audio Preprocessing: The quality of vocal separation and transcription can depend on the original audio quality. If needed, consider pre-processing your audio (e.g., normalization, noise reduction) before running the script.
python main.py
Enter the path to the song file: /path/to/your/song.mp3
Lyrics saved to data/lyrics.txt
The lyrics need to be cleaned up and formatted properly. This is just a raw output that most likely contains errors.
The lyrics content is:
[Lyrics Text]