cutan.audio¶
The cut-out genre’s lip-sync providers: letters, Rhubarb and word timings to mouth shapes.
Moved from an.audio (an#225). an.audio keeps the protocols
(LipSyncProvider, VisemeTrack),
text-to-speech and the pipeline; a viseme only means something to a genre that
draws mouths. The genre registers these by name as lipsync.<name> services
(cutan.genre), which is how render(lipsync="offline") and
an render --lipsync rhubarb keep working.
>>> offline_factory().name
'offline'
Functions
|
The deterministic char-to-viseme provider (the default). |
|
Rhubarb Lip Sync (needs the |
|
Word timings from Whisper, distributed over the mouth shapes. |
Classes
|
Default lip-sync provider: deterministic char-to-viseme mapping. |
|
Wrap the rhubarb CLI. |
|
A |
|
faster-whisper word timestamps → visemes. |
|
|
- class cutan.audio.OfflineLipSync(*, char_to_viseme=None)[source]¶
Bases:
objectDefault lip-sync provider: deterministic char-to-viseme mapping.
Implements the
LipSyncProviderprotocol.
- class cutan.audio.RhubarbLipSync(*, binary_path=None, language='en', recognizer=None, timeout_s=60.0)[source]¶
Bases:
objectWrap the rhubarb CLI. Implements the
LipSyncProviderprotocol.>>> RhubarbLipSync(binary_path="/bin/rhubarb").recognizer 'pocketSphinx' >>> RhubarbLipSync(binary_path="/bin/rhubarb", language="de").recognizer 'phonetic' >>> RhubarbLipSync(binary_path="/bin/rhubarb", language="de").name 'rhubarb:phonetic'- repeatable: bool = True¶
The same audio, transcript and recognizer give the same track on one machine (one binary), and nothing is billed:
an cache gcmay re-make a missing track in memory (an#311, cutan#29). A machine without the binary says so incheck_available().
- class cutan.audio.StaticWordTimings(words, *, label='static')[source]¶
Bases:
objectA
WordTimingProviderover a fixed list of timings.
- class cutan.audio.WhisperLipSync(*, model_size='tiny', device='cpu', compute_type='int8', char_to_viseme=None)[source]¶
Bases:
objectfaster-whisper word timestamps → visemes.
Implements the
LipSyncProviderprotocol. The model is lazy-loaded on the first call (subsequent calls in the same process reuse the instance via the class-level_modelcache).
- class cutan.audio.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.
- cutan.audio.offline_factory(**_)[source]¶
The deterministic char-to-viseme provider (the default).
- Return type:
- cutan.audio.rhubarb_factory(*, language='en', **_)[source]¶
Rhubarb Lip Sync (needs the
rhubarbbinary);languagepicks its recognizer.- Return type:
- cutan.audio.whisper_factory(**_)[source]¶
Word timings from Whisper, distributed over the mouth shapes.
- Return type:
Modules
Lip-sync provider that consumes pre-computed word timings. |
|
OfflineLipSync — deterministic transcript → viseme track. |
|
RhubarbLipSync — calls the rhubarb-lip-sync binary for phoneme-aligned visemes. |
|
WhisperLipSync — faster-whisper word timestamps → viseme keyframes. |