Better Lyrics Translation Toolkit - AI-powered song translation with music constraint preservation
Project description
🥪 BLT - Better Lyrics Translation Toolkit
Overview
BLT is a toolkit for song translation and voice synthesis. The toolkit contains three modular components that can be used independently or combined through pre-defined pipelines.
Toolkit Components
1. Translator
IPA-based lyrics translation tools with music constraints:
| Tool | Description |
|---|---|
LyricsTranslator |
Main translator with syllable/rhyme preservation |
LyricsAnalyzer |
Extract music constraints from lyrics |
ConstraintValidator |
Validate translated lyrics against music constraints |
Music Constraints Extracted:
-
syllable_counts:
list[int](ex. [4, 3])- Chinese: Character-based
- Other languages: IPA vowel nuclei
-
syllable_patterns:
list[list[int]](ex. [[1, 1, 2], [1, 2]])- With audio (WIP): Alignment problem - timing sync with vocals
- Without audio: Word segmentation problem
- Chinese: HanLP tokenizer
- English: Space splitting
- Other languages: LLM-based
-
rhyme_scheme:
str(ex. AB)- Chinese: Pinyin finals
- Other languages: IPA phonemes
Translation Flow
flowchart TD
A[Source Lyrics] --> B[LyricsAnalyzer]
B --> |Extract Constraints| C{LyricsTranslator}
C --> |Generate Translation| D[ConstraintValidator]
D --> |Check Constraints| E{Valid or Max Retries}
E --> |No| C
E --> |Yes| F[Target Lyrics]
style B fill:#64b5f6,stroke:#1976d2,stroke-width:2px,color:#fff
style C fill:#1976d2,stroke:#0d47a1,stroke-width:2px,color:#fff
style D fill:#42a5f5,stroke:#1976d2,stroke-width:2px,color:#fff
2. Synthesizer
TTS, alignment, and voice synthesis tools:
| Tool | Description |
|---|---|
VocalSeparator |
Separate vocals from instrumental tracks |
LyricsAligner |
Align lyrics timing with audio |
VoiceSynthesizer |
Synthesize vocals with new lyrics |
3. Pipeline
Pre-defined combinations of tools:
| Pipeline | Description |
|---|---|
CoverSongPipeline |
End-to-end pipeline for generating translated cover songs |
Setup
uv venv --python 3.11
source .venv/bin/activate
uv sync
Usage
To generate a translated cover song, use the examples/gen_translated_song.py script:
uv run python examples/gen_translated_song.py \
--audio "path/to/your/song.mp3" \
--old-lyrics-file "path/to/original/lyrics.txt" \
--new-lyrics-file "path/to/new/lyrics.txt" \
--output-name "my_cover_song"
Parameters:
--audio: Path to the original song audio file.--old-lyrics-file: Path to a text file containing the original lyrics.--new-lyrics-file: Path to a text file containing the new lyrics.--output-name: The name for the generated cover song files.--device: The device to run the models on (cudaorcpu).
Acknowledgments
License
Apache License 2.0
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 blt_toolkit-0.1.0.tar.gz.
File metadata
- Download URL: blt_toolkit-0.1.0.tar.gz
- Upload date:
- Size: 185.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6295ecda8b6b3b318f09a435b426edb07f753bc9b5683ded8e22d14238268108
|
|
| MD5 |
f7a280d26178daca918ab5e1127cf874
|
|
| BLAKE2b-256 |
1774bd06ce6997d193b6ff9c293958becdc2775ad0a542d4b23c6bbd39f95ff9
|
Provenance
The following attestation bundles were made for blt_toolkit-0.1.0.tar.gz:
Publisher:
publish.yml on guan404ming/blt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blt_toolkit-0.1.0.tar.gz -
Subject digest:
6295ecda8b6b3b318f09a435b426edb07f753bc9b5683ded8e22d14238268108 - Sigstore transparency entry: 759807617
- Sigstore integration time:
-
Permalink:
guan404ming/blt@ca4dc138c57b9466de379a11853627e5862d54d4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/guan404ming
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca4dc138c57b9466de379a11853627e5862d54d4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file blt_toolkit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: blt_toolkit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 34.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30ae8634bbb3fdc8ebf7fc914d9f7e27708577d785aba407f3d36d8309a68fe8
|
|
| MD5 |
4a9cfbd0c8d1557028a34fb51d30a72b
|
|
| BLAKE2b-256 |
9c006debb1bfed04ee83aa1e153ee5654804d132bdd7e2bd64722b5910c58275
|
Provenance
The following attestation bundles were made for blt_toolkit-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on guan404ming/blt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blt_toolkit-0.1.0-py3-none-any.whl -
Subject digest:
30ae8634bbb3fdc8ebf7fc914d9f7e27708577d785aba407f3d36d8309a68fe8 - Sigstore transparency entry: 759807640
- Sigstore integration time:
-
Permalink:
guan404ming/blt@ca4dc138c57b9466de379a11853627e5862d54d4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/guan404ming
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ca4dc138c57b9466de379a11853627e5862d54d4 -
Trigger Event:
push
-
Statement type: