> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Speech & Audio

> The voice-first modality (speech in, speech out) plus background audio and TTS caching.

Speech is the default modality. The caller speaks, [speech-to-text](/plugins/stt/deepgram)
transcribes, the [LLM](/plugins/llm/google) replies, and [text-to-speech](/plugins/tts/cartesia)
voices the answer, or a single [realtime](/build/configure-a-pipeline/modes) model does it
end to end. Beyond the core loop, this modality covers how the agent *sounds* and the audio
it plays around the conversation.

<CardGroup cols={2}>
  <Card title="Audio Customization" icon="sliders" href="/build/modalities/speech-and-audio/audio-customization">
    Choose the voice and tune speed, pitch, and emotion.
  </Card>

  <Card title="Background Audio" icon="music" href="/build/modalities/speech-and-audio/background-audio">
    Play thinking sounds and ambient music during a call.
  </Card>

  <Card title="STT & TTS Plugins" icon="puzzle-piece" href="/plugins/overview">
    Browse the speech-to-text and text-to-speech providers.
  </Card>
</CardGroup>

## The voice loop

<CodeGroup>
  ```python title="main.py" Python theme={null}
  from zrt import Pipeline
  from zrt.plugins import DeepgramSTT, OpenAILLM, CartesiaTTS, SileroVAD, TurnDetector
  from zrt.inference import AICousticsDenoise

  pipeline = Pipeline(
      stt=DeepgramSTT(),
      llm=OpenAILLM(),
      tts=CartesiaTTS(),
      vad=SileroVAD(),
      turn_detector=TurnDetector(model="echo-large"),
      denoise=AICousticsDenoise(model_id="quail-vf-2.2-l-16khz"),
  )
  ```
</CodeGroup>

To swap voice providers, change the `stt`/`tts` plugins. To collapse the loop into one
low-latency model, pass a realtime model as `llm`. See [Pipeline Modes](/build/configure-a-pipeline/modes).

## References

<Tabs>
  <Tab title="Python">
    #### Examples

    <CardGroup cols={2}>
      <Card title="Background Audio" icon="github" href="https://github.com/ZeroRuntimeAI/zrt-python-sdk-examples/blob/main/features/background_audio.py">
        Play ambient or hold audio during a call.
      </Card>

      <Card title="Enhanced Pronunciation" icon="github" href="https://github.com/ZeroRuntimeAI/zrt-python-sdk-examples/blob/main/features/pronunciation.py">
        Tune how the agent pronounces words.
      </Card>
    </CardGroup>

    #### SDK Reference

    <CardGroup cols={2}>
      <Card title="Speech Generation" icon="book" href="/api-reference/python/core/agent-and-session">
        `Speech Generation` in the Python API reference.
      </Card>

      <Card title="TTS" icon="book" href="/api-reference/python/core/pipeline">
        `TTS` in the Python API reference.
      </Card>
    </CardGroup>
  </Tab>
</Tabs>
