cutan.audio.injectable_lipsync¶
Lip-sync provider that consumes pre-computed word timings.
Useful when an upstream system already has authoritative word-level
timings and would otherwise force an to re-transcribe the same
audio. The canonical case is muvid, where the lyric → audio
alignment store (lacing) is the SSOT and re-running
WhisperLipSync on the audio produces a redundant (and possibly
divergent) word-timestamp set.
Two pieces:
StaticWordTimings— aWordTimingProviderover a fixed list of(word, start, end)tuples.WordTimingsLipSync— aLipSyncProviderthat reads from anyWordTimingProviderand runs the same word→viseme conversion asWhisperLipSync(viaword_timings_to_visemes()), so output is shape-compatible withthe rest of the cutout pipeline.
Drop-in usage:
from cutan.audio.injectable_lipsync import (
StaticWordTimings, WordTimingsLipSync,
)
timings = [("hello", 0.5, 1.0), ("world", 1.2, 1.8)]
lipsync = WordTimingsLipSync(StaticWordTimings(timings))
track = lipsync.align(audio_clip, "hello world")
Classes
|
A |
|
|
- class cutan.audio.injectable_lipsync.StaticWordTimings(words, *, label='static')[source]¶
Bases:
objectA
WordTimingProviderover a fixed list of timings.
- class cutan.audio.injectable_lipsync.WordTimingsLipSync(provider, *, char_to_viseme=None, convention='rhubarb', rest_viseme='X', min_gap_for_rest=0.2)[source]¶
Bases:
objectLipSyncProviderdriven by aWordTimingProvider.Skips transcription entirely. Use this when the caller already has authoritative word timings (e.g. from a separate lyric-alignment pipeline).
- Parameters:
provider (
WordTimingProvider) – anyWordTimingProvider.char_to_viseme (
dict[str,str] |None) – optional override of the character→viseme code mapping; defaults to the one shared withOfflineLipSync/WhisperLipSync.convention (
str) – declared viseme convention string for the produced track. Defaults to"rhubarb"for compatibility with the existing cutout adapter.rest_viseme (
str) – code emitted in silent gaps. Defaults to_REST_VISEME.min_gap_for_rest (
float) – minimum inter-word silence (seconds) before we insert a rest keyframe. Defaults to0.20.