| name | Caption Alignment |
| description | Align text to audio timestamps using Qwen3-ForcedAligner (~30ms precision) |
| triggers | ["Karaoke captions","Word-level timestamps","Subtitle synchronization"] |
Caption Alignment Skill
Align text to audio timestamps for karaoke-style rolling captions.
Usage
from skills.align_captions import CaptionAligner
aligner = CaptionAligner()
captions = await aligner.align_audio(
audio_path=Path("speech.wav"),
text="Hello world!",
language="English",
)
captions = await aligner.align_dialogue_lines(
audio_paths=[Path("line1.wav"), Path("line2.wav")],
texts=["Hello!", "Hi there!"],
)
Output Format
@dataclass
class WordSegment:
text: str
start_ms: int
end_ms: int
@dataclass
class AlignedCaption:
text: str
start_ms: int
end_ms: int
words: list[WordSegment]
Dependencies
- qwen-asr (Qwen3-ForcedAligner)
- jieba (for Chinese word segmentation)
- torch
Install
pip install qwen-asr jieba torch