An automatic lyrics timing generator based on OpenAI Whisper. This tool automatically aligns lyrics with audio files to generate timestamped LRC files.
- Supports multiple audio formats (MP3, WAV, etc.)
- Uses Whisper for accurate speech recognition
- Automatic lyrics-to-audio alignment
- Generates standard LRC format files
- Supports special characters in lyrics
- Handles repeated lyrics sections
- Provides detailed debugging information
- Python 3.8 or higher
- FFmpeg (for audio processing)
- PyTorch (for Whisper model)
-
Install FFmpeg (if not already installed):
# macOS brew install ffmpeg # Ubuntu/Debian sudo apt-get install ffmpeg
-
Clone the repository:
git clone [repository-url] cd LRC-Generator -
Install dependencies:
pip install -r requirements.txt
Basic usage:
lrc-gen generate --audio "path/to/audio" --lyrics "path/to/lyrics"Example:
lrc-gen generate --audio "./songs/my_song.mp3" --lyrics "./lyrics/my_lyrics.txt"If your filenames contain spaces or special characters, you can:
-
Use quotes:
lrc-gen generate --audio "./songs/my song.mp3" --lyrics "./lyrics/my lyrics.txt"
-
Use backslash escaping:
lrc-gen generate --audio ./songs/my\ song.mp3 --lyrics ./lyrics/my\ lyrics.txt
- Supported formats: MP3, WAV, M4A, FLAC, etc.
- High-quality audio recommended for better recognition
- Plain text file (.txt)
- UTF-8 encoding
- One line per lyric
- No timestamps
- Arranged in singing order
Example lyrics file format:
verse 1
First line of lyrics
Second line of lyrics
chorus
This is the chorus
Second line of chorus
- Generated LRC file will have the same name as the lyrics file (different extension)
- Location: Same directory as the lyrics file
- Format: Standard LRC format, UTF-8 encoding (with BOM)
Example output:
[ti:Song Title]
[ar:Artist]
[al:Album]
[length:03:45]
[00:01.23]First line of lyrics
[00:05.67]Second line of lyrics
[00:10.89]This is the chorus
The program generates two debug files:
whisper_transcription.txt: Contains Whisper's speech recognition resultsdebug_segments.txt: Contains detailed matching process information
- First run will download the Whisper model, requiring internet connection
- Processing time depends on audio length and chosen model size
- High-quality audio files recommended for better recognition
- If lyrics matching is not ideal:
- Check lyrics text accuracy
- Ensure correct lyrics order
- Review debug files for detailed matching process
This project is licensed under the MIT License - see the LICENSE file for details.
Issues and Pull Requests are welcome!