Integrations

KugelAudio text to speech for Pipecat

KugelAudio provides an official TTS service for Pipecat. Put KugelAudioTTSService into your pipeline where the TTS stage goes and the rest of the bot stays as it is.

How it works

What the integration does

  • A drop-in TTSService

    It emits the standard Pipecat frames, so it fits any pipeline built on Pipecat 0.x or 1.x.

  • Connection reuse

    Call prewarm() in your async setup and the service reuses one WebSocket across turns, reconnecting if it drops.

  • Metrics included

    Pipecat TTFB and character usage are reported automatically. KugelAudioEnhanceFilter removes background noise on the input.

Code

A local voice bot

Microphone in, Deepgram STT, OpenAI LLM, KugelAudio TTS, speaker out. Set KUGELAUDIO_API_KEY, DEEPGRAM_API_KEY and OPENAI_API_KEY, then run python bot.py.

Install
pip install "kugelaudio[pipecat]" "pipecat-ai[deepgram,local,openai,silero]"
bot.py
import asyncio
import os

from pipecat.audio.vad.silero import SileroVADAnalyzer
from pipecat.frames.frames import TTSSpeakFrame
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner
from pipecat.pipeline.task import PipelineTask
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.llm_response_universal import (
    LLMContextAggregatorPair,
)
from pipecat.services.deepgram.stt import DeepgramSTTService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.transports.local.audio import (
    LocalAudioTransport,
    LocalAudioTransportParams,
)

from kugelaudio.pipecat import KugelAudioTTSService


async def main():
    transport = LocalAudioTransport(
        LocalAudioTransportParams(
            audio_in_enabled=True,
            audio_out_enabled=True,
            audio_out_sample_rate=24000,
            vad_enabled=True,
            vad_analyzer=SileroVADAnalyzer(),
        )
    )
    stt = DeepgramSTTService(api_key=os.environ["DEEPGRAM_API_KEY"])
    llm = OpenAILLMService(
        api_key=os.environ["OPENAI_API_KEY"],
        settings=OpenAILLMService.Settings(
            model="gpt-4o-mini",
            system_instruction="You are a helpful voice assistant. Keep answers short.",
        ),
    )
    tts = KugelAudioTTSService(
        model="kugel-3.5",
        voice_id=1071,
        sample_rate=24000,  # must match the transport's output rate
        language="en",      # normalization language (default: the voice's)
    )
    tts.prewarm()  # needs the running event loop, so call it inside main()

    context_aggregator = LLMContextAggregatorPair(LLMContext())
    pipeline = Pipeline(
        [
            transport.input(),
            stt,
            context_aggregator.user(),
            llm,
            tts,
            transport.output(),
            context_aggregator.assistant(),
        ]
    )

    task = PipelineTask(pipeline)
    await task.queue_frames([TTSSpeakFrame("Hi! How can I help you?")])
    await PipelineRunner().run(task)


if __name__ == "__main__":
    asyncio.run(main())

Copied from the documentation at docs.kugelaudio.com/integrations/pipecat. Read the full guide

Give your agent a KugelAudio voice

Create an account, copy an API key from the dashboard and pick a voice. Every integration on this page runs on the same API.