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.
Cases where modifications may be needed on the input file :
- Words in "japenglish" transcribed in romaji into english won't be recognised if kana lyrics transcribed the word in katakana. Exemple: "Asphalt" pronounced "ASUFARUTO"
- Some karaoke timers put apostrophes on muted vowels. Those will cause errors during the first phase.
- Unusual characters or punctuation signs may cause issues, removing them when a sync error is raised is recommended.
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
Metadata
Release files for kara_kanji_sync 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kara_kanji_sync-0.1.12.tar.gz | 6.2 MB | Without provenance | Details for kara_kanji_sync-0.1.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kara_kanji_sync-0.1.12-py3-none-any.whl | Python 3 | none | any | Details for kara_kanji_sync-0.1.12-py3-none-any.whl |
Total release size: 11.2 MB
Release files / kara_kanji_sync-0.1.12.tar.gz
| Download URL | kara_kanji_sync-0.1.12.tar.gz |
|---|---|
| Size | 6.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7fae96bda11226b4b97c6185a961a816cf6c985e8125adea8a8db366b332585
|
|
BLAKE2b-256 checksum How to use checksums |
b8c716970a1bd8250a6673aa0222f2b0445888569ad8a24a462b5b31582e89ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.19
|
Release files / kara_kanji_sync-0.1.12-py3-none-any.whl
| Download URL | kara_kanji_sync-0.1.12-py3-none-any.whl |
|---|---|
| Size | 5.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f32d47bb7fb43cb79edcd7b1e27a4013e27f88900084f61f6ddb2584ca9aaa1
|
|
BLAKE2b-256 checksum How to use checksums |
14678e013a57ab4c7080e3989aef95f310784fb939c1eeeaadf0d4295f23a900
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.19
|
Security for kara_kanji_sync 0.1.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.