Overview
Azure Speech provides a streaming TTS service with high accuracy, realtime transcription. You can use the open source Azure Speech plugin for LiveKit Agents to build voice AI with fast, accurate transcription.
Quick reference
This section provides a brief overview of the Azure Speech TTS plugin. For more information, see Additional resources.
Installation
Install the plugin from PyPI:
pip install "livekit-agents[azure]~=1.0rc"
Authentication
The Azure Speech plugin requires an Azure Speech key.
Set the following environment variables in your .env
file:
AZURE_SPEECH_KEY=<azure-speech-key>AZURE_SPEECH_REGION=<azure-speech-region>AZURE_SPEECH_HOST=<azure-speech-host>
Usage
Use an Azure Speech TTS within an AgentSession
or as a standalone speech generator. For example, you can use this TTS in the Voice AI quickstart.
from livekit.plugins import azuresession = AgentSession(tts=azure.TTS(speech_key="<speech_service_key>",speech_region="<speech_service_region>",),# ... llm, stt, etc.)
To create an instance of azure.TTS
, one of the following options must be met:
speech_host
must be set, orspeech_key
andspeech_region
must both be set, orspeech_auth_token
andspeech_region
must both be set.
Parameters
This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.
Voice for text-to-speech. To learn more, see Select synthesis language and voice.
Language of the input text. To learn more, see Select synthesis language and voice.
Specify changes to pitch, rate, and volume for the speech output. To learn more, see Adjust prosody.
Azure Speech speech-to-text key. To learn more, see Azure Speech prerequisites.
Azure Speech speech-to-text region. To learn more, see Azure Speech prerequisites.
Azure Speech endpoint.
Azure Speech authentication token.
Controlling speech and pronunciation
Azure Speech TTS supports Speech Synthesis Markup Language (SSML) for customizing generated speech. To learn more, see SSML overview.
Additional resources
The following resources provide more information about using Azure Speech with LiveKit Agents.
Python package
The livekit-plugins-azure
package on PyPI.
Plugin reference
Reference for the Azure Speech TTS plugin.
GitHub repo
View the source or contribute to the LiveKit Azure Speech TTS plugin.
Azure Speech docs
Azure Speech's full docs site.
Voice AI quickstart
Get started with LiveKit Agents and Azure Speech.
Azure ecosystem guide
Overview of the entire Azure AI and LiveKit Agents integration.