tts
Pocket TTS service implementation using kyutai-labs’ pocket-tts.
- pipecat.services.pocket_tts.tts.language_to_pocket_tts_language(language: Language) str[source]
Convert a Language enum to a pocket-tts model language name.
- Parameters:
language – The Language enum value to convert.
- Returns:
The corresponding pocket-tts model language name.
- class pipecat.services.pocket_tts.tts.PocketTTSSettings(model: str | None | NotGiven = <factory>, extra: dict[str, Any]=<factory>, voice: str | None | NotGiven = <factory>, language: Language | str | None | NotGiven = <factory>)[source]
Bases:
TTSSettingsSettings for PocketTTSService.
- class pipecat.services.pocket_tts.tts.PocketTTSService(*, temp: float | None = None, quantize: bool = False, settings: PocketTTSSettings | None = None, **kwargs)[source]
Bases:
TTSServicePocket TTS service implementation.
Provides local, CPU-only text-to-speech synthesis using kyutai-labs’ pocket-tts streaming model. Model weights and voice prompts are downloaded from Hugging Face on first use, which may block for a while.
The voice may be a predefined voice name (e.g.
"alba"), a local.wavfile to clone, an exported.safetensorsvoice state, or anhf://path. The voice can be changed at runtime; the language cannot, since model weights are loaded per language.- Settings
alias of
PocketTTSSettings
- __init__(*, temp: float | None = None, quantize: bool = False, settings: PocketTTSSettings | None = None, **kwargs)[source]
Initialize the Pocket TTS service.
- Parameters:
temp – Sampling temperature for audio generation. Defaults to the pocket-tts model default.
quantize – Quantize model weights for faster CPU inference (requires the
torchaopackage).settings – Runtime-updatable settings. Defaults to the
"alba"voice and English.**kwargs – Additional arguments passed to the parent TTSService.
- language_to_service_language(language: Language) str[source]
Convert a Language enum to a pocket-tts model language name.
- Parameters:
language – The language to convert.
- Returns:
The pocket-tts model language name.
- async run_tts(text: str, context_id: str) AsyncGenerator[Frame, None][source]
Generate speech from text using pocket-tts.
- Parameters:
text – The text to convert to speech.
context_id – Unique identifier for this TTS context.
- Yields:
Frame – Audio frames containing the synthesized speech.
- async setup(setup: FrameProcessorSetup)
Set up the service.
- Parameters:
setup – Configuration object containing setup parameters.