from collections import namedtuple # store '{与|あた}えた{使命|しめい} ' as [('与','あた'), ('えた',''), ('使命','しめい'), (' ','')] FuriBlock = namedtuple('FuriBlock', ['kanji', 'furi']) # spb (seconds per beat) is preferred to bpm (beats per minute) # spb = 60.0/bpm class LyricLine: beat_stamps: list[float] = [] # Start at zero for each line, do real timing via get_timestamps() translated_line: str hiragana_syllables: list[str] # Allow space entries which will be skipped over when calculating timing romaji_syllables: list[str] # Allow space entries which will be skipped over when calculating timing furi_blocks: list[FuriBlock] def get_timestamps(self, spb: float, start_offset: float) -> list[float]: return [(spb*beat)+start_offset for beat in self.beat_stamps] def get_karaoke_centiseconds(self, spb: float) -> list[float]: return [int(spb*beat*100) for beat in self.beat_stamps] class LyricTrack: lines: list[LyricLine]