Align kanji lyrics with romaji karaokes
Project description
kara-kanji-sync
From lyrics in japanese and an already timed karaoke in romaji Aegisub subtitles file (.ass), generate a new subtitle file timed in japanese.
Getting Started
Notebook
Open the notebook in Google Colab, save a copy and follow the instructions.
Pypi
pip install kara-kanji-sync
Methodology
Algorithm
- The algorithm starts by trying to find the hiragana, katakana and english words from the original lyrics in the romaji lyrics from the already timed karaoke. It associates each group of kanji to a group of romaji syllables.
- To associate each kanji of the group to its appropriate syllables, the algorithm tries all pronunciations of all possible combination of kanji until it finds the right one. The pronunciation for individual kanji is from Jisho and for group is from JmdictFurigana.
- It recreates the line with punctuation and special characters from lyrics.
Caveats
- Each lyric line has to be strictly aligned with the one from the ASS file.
- Numbers are not treated, they may have to be replaced by kanji or modified manually in the result file.
- Some words composed by multiple kanji followed by hiragana can be missed.
Recommended workflow
- Get the lyrics (preferably on a reliable website like Lyrical Nonsense).
- Get the ass file.
Using the notebook
Just the follow the instructions that globally in
- Installing the package.
- Uploading the file.
- Inputting the lyrics with an interface that shows lines from uploaded ass which facilitate this phase.
- Launching a lyrics check.
- Launching the main algorithm.
- Downloading the result.
Using the package
Here a code snippet to generate from lyrics and sub
import pysubs2
from kara_kanji_sync import KanjiSyncer
subs = pysubs2.load(f"path_to_ass_file.ass")
lyrics = open(f"path_to_lyrics.txt").read()
kanji_syncer = KanjiSyncer()
kanji_syncer.subtitles_file = subs
kanji_syncer.lyrics = lyrics.splitlines()
kanji_file = kanji_syncer.sync_subs("Kanji Top") # You can choose "Kanji Bottom" to have the subtitles on the bottom
kanji_file.save(f"result.ass")
print(kanji_syncer.errors) # Shows all the potential errors
In Aegisub, on the result file
- Load the ass file and the video.
- Modify the styles Kanji Top and Kanji Top - Right (or Kanji Bottom and Kanji Bottom - Right if you chose this option in the sync_sub function).
- Automation -> Apply karaoke template
References
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 kara_kanji_sync-0.1.11.tar.gz.
File metadata
- Download URL: kara_kanji_sync-0.1.11.tar.gz
- Upload date:
- Size: 6.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1392f42f09cf441fec49497c7859cd4377f8aab0b62d6c32c1afd7bcfddd91ad
|
|
| MD5 |
5a801301ee1cd2849f5b6924c6148585
|
|
| BLAKE2b-256 |
324806b2225452d4696f99915b93e178f8b7d2055893548e34716c81cf619e19
|
File details
Details for the file kara_kanji_sync-0.1.11-py3-none-any.whl.
File metadata
- Download URL: kara_kanji_sync-0.1.11-py3-none-any.whl
- Upload date:
- Size: 5.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a903c39471585b8313fbbb36f26e8cb553f6fee3da72c53ffc864690f78c7cdf
|
|
| MD5 |
6fe8ec7ddf79e894db181c34f3412542
|
|
| BLAKE2b-256 |
47ec1a96be483445ba4cffdfbd39058da1042f2e6aa4a5484e8f14a6859f349b
|