Stream speech inside your pipeline.

Configure the elbic Python TTS service with an API key and voice ID. Run the microphone-to-speaker example and listen to one generated reply.

Set up your first test.

Add a TTS stage
Insert the elbic service after your text-generating stage. Keep the transport and other stages configured for your application.
Run a local conversation
The example uses the microphone, a speech recognizer, a language model and your speakers. Supply the credentials for the services you choose.
Check the timing
Use Pipecat’s first-byte metrics and listen for the pause before speech. Compare first turns and later turns on a warmed connection.

Code

Run the Pipecat example.

Microphone in, Deepgram STT, OpenAI LLM, elbic 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[local,openai]"
bot.py
import asyncio
import os

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,
    LLMUserAggregatorParams,
)
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.transports.local.audio import (
    LocalAudioTransport,
    LocalAudioTransportParams,
)
from pipecat.turns.user_turn_strategies import ExternalUserTurnStrategies

from kugelaudio.pipecat import KugelAudioSTTService, KugelAudioTTSService


async def main():
    transport = LocalAudioTransport(
        LocalAudioTransportParams(
            audio_in_enabled=True,
            audio_out_enabled=True,
            audio_out_sample_rate=24000,
        )
    )
    # The server hears when the user has finished; no local VAD needed.
    stt = KugelAudioSTTService(language="en")
    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(),
        # Let the STT's turns drive the conversation.
        user_params=LLMUserAggregatorParams(
            user_turn_strategies=ExternalUserTurnStrategies()
        ),
    )
    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

Before your first test.

What do I need besides elbic credentials?

The reference example also needs credentials for the speech recognition and language model providers shown in the guide.

Where do I choose the voice?

Set the voice ID on the TTS service and test the same prompt if you swap voices.

Run the Pipecat example.

Follow the documented setup, then listen to the output with a script from your application.

Contact sales

Tell us what you’re building.

or write a message