tts

Groq text-to-speech service implementation.

class pipecat.services.groq.tts.GroqTTSSettings(model: str | None | NotGiven = <factory>, extra: dict[str, Any]=<factory>, voice: str | None | NotGiven = <factory>, language: Language | str | None | NotGiven = <factory>, speed: float | None | NotGiven = <factory>)[source]

Bases: TTSSettings

Settings for GroqTTSService.

Parameters:

speed – Speech speed multiplier. Defaults to 1.0.

class pipecat.services.groq.tts.GroqTTSService(*, api_key: str, output_format: Literal['flac', 'mp3', 'mulaw', 'ogg', 'wav'] | str = 'wav', params: InputParams | None = None, model_name: str | None = None, voice_id: str | None = None, sample_rate: int | None = None, settings: GroqTTSSettings | None = None, **kwargs)[source]

Bases: TTSService

Groq text-to-speech service implementation.

Provides text-to-speech synthesis using Groq’s TTS API. The service operates at a default 24kHz sample rate and supports various voices, output formats, and sample rates.

Settings

alias of GroqTTSSettings

class InputParams(*, language: Language | None = Language.EN, speed: float | None = 1.0)[source]

Bases: BaseModel

Input parameters for Groq TTS configuration.

Deprecated since version 0.0.105: Use settings=GroqTTSService.Settings(...) instead. Will be removed in 2.0.0.

Parameters:
  • language – Language for speech synthesis. Defaults to English.

  • speed – Speech speed multiplier. Defaults to 1.0.

language: Language | None
speed: float | None
__init__(*, api_key: str, output_format: Literal['flac', 'mp3', 'mulaw', 'ogg', 'wav'] | str = 'wav', params: InputParams | None = None, model_name: str | None = None, voice_id: str | None = None, sample_rate: int | None = None, settings: GroqTTSSettings | None = None, **kwargs)[source]

Initialize Groq TTS service.

Parameters:
  • api_key – Groq API key for authentication.

  • output_format – Audio output format. Defaults to “wav”.

  • params –

    Additional input parameters for voice customization.

    Deprecated since version 0.0.105: Use settings=GroqTTSService.Settings(...) instead. Will be removed in 2.0.0.

  • model_name –

    TTS model to use.

    Deprecated since version 0.0.105: Use settings=GroqTTSService.Settings(model=...) instead. Will be removed in 2.0.0.

  • voice_id –

    Voice identifier to use.

    Deprecated since version 0.0.105: Use settings=GroqTTSService.Settings(voice=...) instead. Will be removed in 2.0.0.

  • sample_rate – Audio sample rate. If None, uses default sample rate.

  • settings – Runtime-updatable settings. When provided alongside deprecated parameters, settings values take precedence.

  • **kwargs – Additional arguments passed to parent TTSService class.

can_generate_metrics() → bool[source]

Check if this service can generate processing metrics.

Returns:

True, as Groq TTS service supports metrics generation.

async run_tts(text: str, context_id: str) → AsyncGenerator[Frame, None][source]

Generate speech from text using Groq’s TTS API.

Parameters:
  • text – The text to synthesize into speech.

  • context_id – The context ID for tracking audio frames.

Yields:

Frame – Audio frames containing the synthesized speech data.

async setup(setup: FrameProcessorSetup)

Set up the service.

Parameters:

setup – Configuration object containing setup parameters.