Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
AzureTTS
Azure Cognitive Services Neural Text-to-Speech provider. Synthesizes speech using Azure Neural TTS voices, supporting hundreds of voices across 60+ languages at up to 48 kHz. Standard Neural voices are available at 24 kHz and 48 kHz; streaming output is returned as PCM audio.Constructor
Azure Speech resource subscription key. Falls back to the
AZURE_SPEECH_KEY environment variable when omitted.Azure region identifier for the Speech resource (e.g.
"eastus", "westeurope", "southeastasia"). Falls back to the AZURE_REGION environment variable, then "eastus" as a hard default. Must match the region where your Azure Speech resource was created. Keys are region-scoped.Azure Neural TTS voice name in
"<locale>-<Name>Neural" format. Defaults to "en-US-JennyNeural" (female, US English). Common options include "en-US-AriaNeural", "en-US-GuyNeural", "en-GB-SoniaNeural", "fr-FR-DeniseNeural", "de-DE-KatjaNeural", "ja-JP-NanamiNeural". See the Azure language-support docs for the full voice catalog.PCM output sample rate in Hz. Azure Neural TTS natively supports
24000 (standard) and 48000 (high-fidelity). Defaults to 24000.aclose
emit
The event to emit.
interrupt
off
The event the handler was registered for.
The handler to remove.
on
callback is omitted.
The event to listen for.
The handler to invoke when the event is emitted. If
None, a decorator is returned that registers the decorated function.The registered callback when
callback is provided, otherwise a decorator that registers and returns the function it wraps.on_first_audio_byte
A callable, optionally async, invoked with synthesis timing information when the first audio byte is emitted.
synthesize
The text to synthesize; coerced to a string if needed.