Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
NeuphonicTTS
Neuphonic text-to-speech provider for low-latency, streaming voice synthesis. Synthesizes audio from text using Neuphonic’s hosted TTS service, with selectable voices, multilingual support, and configurable output sampling rate.Constructor
Neuphonic API key. Falls back to the
NEUPHONIC_API_KEY environment variable when omitted.Voice identifier (a UUID string from your Neuphonic voice library). The chosen voice also determines which underlying model is used. Defaults to
None, letting Neuphonic select a default voice.Language code for synthesis. Defaults to
'en'. Other supported codes include 'es', 'pt', 'fr', 'de', 'zh', 'ja', 'ko', and 'ur'.Output audio sampling rate in Hz. Defaults to
22050. Valid values: 8000, 16000, 22050, 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.