Microsoft Azure

Updated

Integrate Microsoft Azure TTS into Conversational AI Engine.

Microsoft Azure offers neural voices in multiple languages with options for different speaking styles and emotions, providing enterprise-grade text-to-speech capabilities with high-quality audio output.

Sample configuration

The following examples show how to configure Microsoft Azure TTS when starting a conversational AI agent.

from agora_agent import Agent
from agora_agent.agentkit.vendors import MicrosoftTTS

# client is your configured Agora client
agent = (
    Agent(client)
    .with_stt(...)  # configure your STT vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(MicrosoftTTS(
        key='your-azure-key',
        region='eastus',
        voice_name='en-US-AndrewMultilingualNeural',
        speed=1.0,
        volume=70,
    ))
)
import { Agent, MicrosoftTTS } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your STT vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(new MicrosoftTTS({
    key: 'your-azure-key',
    region: 'eastus',
    voiceName: 'en-US-AndrewMultilingualNeural',
    speed: 1.0,
    volume: 70,
  }));
import "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"

// client is your configured Agora client
agent := agentkit.NewAgent(client).WithStt(/* configure your STT vendor */).
  WithLlm(/* configure your LLM vendor */).
  WithTts(
    vendors.NewMicrosoftTTS(vendors.MicrosoftTTSOptions{
        Key:       "your-azure-key",
        Region:    "eastus",
        VoiceName: "en-US-AndrewMultilingualNeural",
        Speed:     agora.Float64(1.0),
        Volume:    agora.Float64(70),
    }),
)

Use the following tts configuration in your request:

"tts": {
  "vendor": "microsoft",
  "params": {
    "key": "<your_microsoft_key>",
    "region": "eastus",
    "voice_name": "en-US-AndrewMultilingualNeural",
    "speed": 1.0,
    "volume": 70,
    "sample_rate": 24000
  }
}

Caution

The parameters listed on this page are validated for use with Conversational AI Engine. Required parameters must be provided as documented. Any additional parameters are passed through directly to the underlying vendor without validation. For advanced configuration options, voice galleries, and detailed parameter descriptions, see the Microsoft Azure TTS documentation.

Key parameters

paramsrequired
keystring
required

The API key used for authentication. Get your API key from the Azure Portal.

regionstring
required

The Azure region where the speech service is hosted (For example, eastus, westus2).

voice_namestring
required

The identifier for the selected voice for speech synthesis. See available voices for options.

speednumber
optional
Default value
1.0

Speaking rate of the text. Values between 0.5 and 2.0 times the original audio speed.

volumenumber
optional
Default value
100

Audio volume as a number between 0.0 and 100.0, where 0.0 is quietest and 100.0 is loudest.

sample_rateinteger
optional
Default value
24000

Audio sampling rate in Hz. Common values: 16000, 24000, 48000.