Automatically create synchronised lyrics files in ASS and MidiCo LRC formats with word-level timestamps, using Whisper and lyrics from Genius and Spotify
Project description
Lyrics Transcriber 🎶
Automatically create synchronised lyrics files in ASS and MidiCo LRC formats with word-level timestamps, using OpenAI Whisper and lyrics from Genius and Spotify, for convenience in use cases such as karaoke video production.
Features 🌟
- Automatically transcribe lyrics with word-level timestamps.
- Outputs lyrics in ASS and MidiCo LRC formats.
- Can fetch lyrics from with Genius and Spotify.
- Command Line Interface (CLI) for easy usage.
- Can be included and used in other Python projects.
Installation 🛠️
Prerequisites
- Python 3.9 or higher
- [Optional] A Genius API token if you want to fetch lyrics from Genius
pip install lyrics-transcriber
Warning The package published to PyPI was created by manually editing
poetry.lockto remove triton, as it is technically a sub-dependency from openai-whisper but is currently only supported on Linux (whisper still works fine without it, and I want this package to be usable on any platform)
Usage 🚀
As a standalone CLI
- To transcribe lyrics from an audio file:
lyrics-transcriber /path/to/your/audiofile.mp3
- To specify Genius API token, song artist, and song title for auto-correction:
lyrics-transcriber /path/to/your/audiofile.mp3 --genius_api_token YOUR_API_TOKEN --artist "Artist Name" --title "Song Title"
As a Python package in your project
- Import LyricsTranscriber in your Python script:
from lyrics_transcriber import LyricsTranscriber
- Create an instance and use it:
transcriber = LyricsTranscriber(audio_filepath='path_to_audio.mp3')
result_metadata = transcriber.generate()
result_metadata contains values as such:
result_metadata = {
"whisper_json_filepath": str,
"genius_lyrics": str,
"genius_lyrics_filepath": str,
"midico_lrc_filepath": str,
"singing_percentage": int,
"total_singing_duration": int,
"song_duration": int,
}
Requirements 📋
- Python >= 3.9
- Python Poetry
- Dependencies are listed in pyproject.toml
Local Development 💻
To work on the Lyrics Transcriber project locally, you need Python 3.9 or higher. It's recommended to create a virtual environment using poetry.
- Clone the repo and cd into it.
- Install poetry if you haven’t already.
- Run poetry install to install the dependencies.
- Run poetry shell to activate the virtual environment.
Contributing 🤝
Contributions are very much welcome! Please fork the repository and submit a pull request with your changes, and I'll try to review, merge and publish promptly!
- This project is 100% open-source and free for anyone to use and modify as they wish.
- If the maintenance workload for this repo somehow becomes too much for me I'll ask for volunteers to share maintainership of the repo, though I don't think that is very likely
License 📄
This project is licensed under the MIT License.
Credits 🙏
- This project uses OpenAI Whisper for transcription, which inspired the entire tool!
- Thanks to @linto-ai for the whisper-timestamped project which solved a big chunk for me.
- Thanks to Genius for providing an API which makes fetching lyrics easier!
Contact 💌
For questions or feedback, please raise an issue or reach out to @beveradb (Andrew Beveridge) directly.
Project details
Release history Release notifications | RSS feed
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 lyrics_transcriber-0.12.4.tar.gz.
File metadata
- Download URL: lyrics_transcriber-0.12.4.tar.gz
- Upload date:
- Size: 36.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08a81c30beb58d9feb8b6db1bba06b8ea9feda4266ef6fe2bb0c29fc2e1e5b69
|
|
| MD5 |
8dc23cd2e97ade214230ae57654d0d6e
|
|
| BLAKE2b-256 |
51e761f7b40bd845fb319319e74879a5bcf0f2465b370cc2fc9afb3e7214ef63
|
File details
Details for the file lyrics_transcriber-0.12.4-py3-none-any.whl.
File metadata
- Download URL: lyrics_transcriber-0.12.4-py3-none-any.whl
- Upload date:
- Size: 37.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c073473828be274fd08a71521d49c5d6b70797f6b008108f131f7e0cfd4bf320
|
|
| MD5 |
ab7cf4b9bf4635c492ed738003a0dd3b
|
|
| BLAKE2b-256 |
1392ce840af5dc160d3191453c844b9bbe774eba598415ae8a2a9928e74f5020
|