Audio Format
Rasa uses a common intermediate audio format calledRasaAudioBytes that
acts as a standard data format to prevent complexity between different
channels, ASR engines, and TTS engines.
Rasa supports the following audio formats:
- 8 bit 8KHz μ-law (mulaw) encoding mono channel
- Linear 16 bit 16KHz PCM mono channel
- Linear 16 bit 24KHz PCM mono channel
- Linear 16 bit 48KHz PCM mono channel
sample_rate config property in credentials.yml:
- 8 bit 8KHz mulaw mono
- 16 bit 16KHz PCM mono
- 16 bit 24KHz PCM mono
- 16 bit 48KHz PCM mono
credentials.yml
browser_audio channel used by the Rasa Inspector and by voice-stream browser clients also accepts the sample_rate property. Rasa passes Linear PCM sample rates (16 kHz, 24 kHz, 48 kHz) through end-to-end without server-side resampling.
Rime TTS and Browser channelRime TTS does not support 48KHz sample rate.
If Browser channel is set to 48KHz sample rate, Rasa will resample audio received from Rime
from 24KHz to 48KHz.
ulaw2lin() or lin2ulaw() and ratecv).
Automatic Speech Recognition (ASR)
This section describes the supported integrations with Automatic Speech Recognition (ASR) or Speech To Text (STT) services.Deepgram
Use the environment variableDEEPGRAM_API_KEY for Deepgram API Key. You can
request a key from Deepgram. It can be configured in a Voice Stream channel
as follows:
credentials.yml
Deepgram v1 models (Nova)
Deepgram v1 models, including Nova models, use Deepgram’s/v1/listen endpoint.
Turn DetectionDeepgram v1 models use two mechanisms to detect when a speaker has finished talking:
- Endpointing: Uses Voice Activity Detection (VAD) to detect silence after speech
- UtteranceEnd: Looks at word timings to detect gaps between words
endpointing and utterance_end_ms control these features respectively. For noisy environments, utterance_end_ms may be more reliable as it ignores non-speech audio. Read more on Deepgram DocumentationConfiguration parameters
endpoint: Optional, defaults toapi.deepgram.com- The endpoint URL for the Deepgram API.endpointing: Optional, defaults to400- Number of milliseconds of silence to determine the end of speech.language(deprecated, uselanguage_map): Optional, defaults toen- The language code for the speech recognition.model(deprecated, uselanguage_map): Optional, defaults tonova-2-general- The model to be used for speech recognition.smart_format: Optional, defaults totrue- Boolean value to enable or disable Deepgram’s smart formatting.utterance_end_ms: Optional, defaults to1000- Time in milliseconds to wait before considering an utterance complete.language_map: Optional, defaults to mapping for english language and model - multilingual agent’s mapping between languages set inconfig.ymlandlanguageandmodelparameters for Deepgram.
Deepgram v1 multilingual support
To configure Deepgram v1 for multilingual agent uselanguage_map property. Keys listed in the map
must match languages (language and additional_languages) mentioned in config.yml.
Deepgram v1 supports language and model as configuration parameters inside language_map.
config.yml
credentials.yml
Deepgram v2 models (Flux)
Deepgram v2 models, including Flux models, use Deepgram’s/v2/listen endpoint.
Turn DetectionDeepgram v2 models use model-integrated end-of-turn detection.
Configuration parameters
endpoint: Optional, defaults toapi.deepgram.com- The endpoint URL for the Deepgram API.eot_threshold: Optional, defaults to Deepgram’s default - Confidence threshold for end-of-turn detection.eot_timeout_ms: Optional, defaults to Deepgram’s default - Maximum silence before forcing end-of-turn detection.language_map: Optional, defaults to mapping for english language and model - multilingual agent’s mapping between languages set inconfig.ymlandlanguageandmodelparameters for Deepgram.
Deepgram v2 multilingual support
To configure Deepgram v2 for a multilingual agent, use thelanguage_map
property. Keys in the map must match the languages (language and
additional_languages) defined in config.yml.
Rasa’s Deepgram v2 integration supports model and language inside language_map.
When language is set, Rasa passes it to Deepgram as a language_hint.
Omit language for single-language modelsOnly set
language for the multilingual flux-general-multi model. For single-language
models such as flux-general-en, omit language, as the model is already English-only.flux-* model inside language_map:
credentials.yml
flux-general-multi model and set language
on each entry to pass a Deepgram language_hint:
credentials.yml
Azure
Requires the python libraryazure-cognitiveservices-speech. The API Key can be set with the environment variable AZURE_SPEECH_API_KEY.
Sample configuration looks as follows:
credentials.yml
Configuration parameters
language(deprecated, uselanguage_map): Required. The language code for the speech recognition. (See Azure documentation for a list of languages).speech_region: Optional, defaults toNone- The region identifier for the Azure Speech service, such aswestus. Ensure that the region matches the region of your subscription.speech_endpoint: Optional, defaults toNone- The service endpoint to connect to. You can use it when you have Azure Speech service behind a reverse proxy.speech_host: Optional, defaults toNone- The service host to connect to. Standard resource path will be assumed. Format is “protocol://host:port” where “:port” is optional.language_map: Optional, defaults to mapping for english language - multilingual agent’s mapping between languages set inconfig.ymlandlanguageparameter for Azure.
speech_region, speech_endpoint and speech_host are optional parameters. They
cannot be all empty at the same time. In that case, speech_region is set to eastus.
When connecting to Azure Cloud, parameter speech_region is enough. Here is an example config,
credentials.yml
Azure ASR Multilingual Support
New in Rasa 3.16.0
language_map property. Keys listed in the map
must match languages (language and additional_langauges) mentioned in config.yml.
Azure ASR supports language as configuration parameter inside language_map.
config.yml
credentials.yml
Others
Looking for integration with a different ASR service? You can create your own custom ASR component.Text To Speech (TTS)
This section describes the supported integrations with Text To Speech (TTS) services. Unless otherwise mentioned, the built-in TTS integrations support input text streaming of generative responses. This means that as the LLM generates text, it is streamed directly to the TTS service in chunks rather than waiting for the complete response before starting speech synthesis. This significantly reduces the response latency of the assistant, which is critical for natural-sounding voice conversations.Azure TTS
The API Key can be set with the environment variableAZURE_SPEECH_API_KEY. Sample configuration looks as follow:
credentials.yml
SSML SupportAzure TTS does not support streaming of generative responses to preserve SSML
(Speech Synthesis Markup Language) functionality. SSML allows for advanced
speech control including pronunciation, pauses, emphasis, and voice
characteristics.
Configuration parameters
language(deprecated, uselanguage_map): Optional, defaults toen-US- The language code for the text-to-speech conversion. (See Azure documentation for a list of languages and voices).voice(deprecated, uselanguage_map): Optional, defaults toen-US-JennyNeural- The voice to be used for the text-to-speech conversion. Voice defines the specific characteristic of the voice, such as speaker’s gender, age and speaking style.timeout: Optional, defaults to10- The timeout duration in seconds for the text-to-speech request.speech_region: Optional, defaults toNone- The region identifier for the Azure Speech service. Ensure that the region matches the region of your subscription.endpoint: Optional, defaults toNone- The service endpoint for Azure Speech service.language_map: Optional, defaults to mapping for english language and voice - multilingual agent’s mapping between languages set inconfig.ymlandlanguageandvoiceparameters for Azure TTS.
Azure TTS Multilingual Support
New in Rasa 3.16.0
language_map property. Keys listed in the map
must match languages (language and additional_langauges) mentioned in config.yml.
Azure TTS supports language and voice as configuration parameters inside language_map.
config.yml
credentials.yml
Cartesia TTS
Use the environment variableCARTESIA_API_KEY for Cartesia API Key. The API Key
requires a Cartesia account. It can be configured in a Voice Stream channel as follows,
credentials.yml
Configuration parameters
language(deprecated, uselanguage_map): Optional, defaults toen- The language code for the text-to-speech conversion.voice: Optional, defaults to248be419-c632-4f23-adf1-5324ed7dbf1d- Theidof the voice to use for text-to-speech conversion. The parameter will be passed to the Cartesia API as"voice": {"mode": "id","id": "VALUE"}timeout: Optional, defaults to10- The timeout duration in seconds for the text-to-speech request.model_id: Optional, defaults tosonic-3.6- The model ID to be used for the text-to-speech conversion.version: Optional, defaults to2026-03-01- The version of the model to be used for the text-to-speech conversion.endpoint: Optional, defaults tohttps://api.cartesia.ai/tts/sse- The endpoint URL for the Cartesia API.language_map: Optional, defaults to mapping for english language - multilingual agent’s mapping between languages set inconfig.ymlandlanguageparameters for Cartesia.
Cartesia Multilingual Support
New in Rasa 3.16.0
language_map property. Keys listed in the map
must match languages (language and additional_langauges) mentioned in config.yml.
Cartesia supports language as configuration parameter inside language_map.
config.yml
credentials.yml
Deepgram TTS
Use the environment variableDEEPGRAM_API_KEY for Deepgram API Key. You can
request a key from Deepgram. It can be configured in a Voice Stream channel
as follows:
credentials.yml
Configuration parameters
Deepgram does not use the parent class parameters oflanguage or voice as each
model is uniquely identified using the format [modelname]-[voicename]-[language].
model_id(deprecated, uselanguage_map): Optional, defaults toaura-2-thalia-en- The list of available options can be found in Deepgram Documentation.endpoint: Optional, defaults towss://api.deepgram.com/v1/speak- The endpoint URL for the Deepgram API.timeout: Optional, defaults to30- The timeout duration in seconds for the text-to-speech request.language_map: Optional, defaults to mapping for english language - multilingual agent’s mapping between languages set inconfig.ymlandmodelparameter for Deepgram.
Deepgram TTS Multilingual Support
New in Rasa 3.16.0
language_map property. Keys listed in the map
must match languages (language and additional_langauges) mentioned in config.yml.
Deepgram TTS supports model as configuration parameter inside language_map.
config.yml
credentials.yml
Rime TTS
Use the environment variableRIME_API_KEY for Rime API Key. You can
request a key from Rime. It can be configured in a Voice Stream channel
as follows:
credentials.yml
No Input Text StreamingRime TTS does not support input text streaming of generative responses. The complete
response text is sent to the TTS service at once, which may result in higher latency
compared to TTS services that support streaming.
Configuration parameters
Rasa uses the Rime Websockets JSON API,language(deprecated, uselanguage_map): Optional, defaults toen- The language code for the text-to-speech conversion. See Rime Documentation for details.voice(deprecated, uselanguage_map): Optional, defaults toastra- The speaker voice to use for text-to-speech conversion. Please refer to Rime Documentation.model_id: Optional, defaults tocoda- The model ID to be used for text-to-speech conversion.endpoint: Optional, defaults towss://users.rime.ai/ws2- The endpoint URL for the Rime API.speed_alpha: Optional, defaults to1.0- Controls the speed of speech synthesis.segment: Optional, defaults toimmediate- Segment mode for synthesis. Use “immediate” for low latency.timeout: Optional, defaults to30- The timeout duration in seconds for the text-to-speech request.no_text_normalization: Optional, defaults toFalse- Turns off text normalization to reduce the amount of computation needed to prepare input text for TTS inference. Rime recommends enabling it to reduce response latency.language_map: Optional, defaults to mapping for english language - multilingual agent’s mapping between languages set inconfig.ymlandlanguageandvoiceparameter for Rime TTS.
Rime TTS Multilingual Support
New in Rasa 3.16.0
language_map property. Keys listed in the map
must match languages (language and additional_langauges) mentioned in config.yml.
Rime TTS supports language and voice as configuration parameters inside language_map.
config.yml
credentials.yml
Others
Looking for integration with a different TTS service? You can create your own custom TTS component.Custom ASR
You can implement your own custom ASR component as a Python class to integrate with any third-party speech recognition service. A custom ASR component must subclass theASREngine class from rasa.core.channels.voice_stream.asr.asr_engine.
Your custom ASR component will receive audio in the RasaAudioBytes format
and may need to convert it to your service’s expected format.
Required Methods
Your custom ASR component must implement the following methods:open_websocket_connection(): Establish a websocket connection to your ASR servicefrom_config_dict(config: Dict): Class method to create an instance from configuration dictionarysignal_audio_done(): Signal to the ASR service that audio input has endedrasa_audio_bytes_to_engine_bytes(chunk: RasaAudioBytes): Convert Rasa audio format to your engine’s expected formatengine_event_to_asr_event(event: Any): Convert your engine’s events to Rasa’sASREventformatget_default_config(): Static method that returns the default configuration for your component
Optional Methods
You may also override these methods as needed:send_keep_alive(): Send keep-alive messages to maintain the connection. The default implementation is only apassstatement.close_connection(): Custom cleanup when closing the connection. Default implementation is as follows,
ASR Events
Yourengine_event_to_asr_event method should return appropriate ASREvent objects:
UserIsSpeaking(transcript): For interim/partial transcripts while the user is speakingNewTranscript(transcript): For final transcripts when the user has finished speaking
Example Implementation
Here’s an example based on the Deepgram implementation structure:custom_asr.py
Custom TTS
You can implement your own custom TTS component as a Python class to integrate with any third-party text-to-speech service. A custom TTS component must subclass theTTSEngine class from
rasa.core.channels.voice_stream.tts.tts_engine.
Your custom TTS component must output audio in the RasaAudioBytes format
and convert it using the engine_bytes_to_rasa_audio_bytes method.
Required Methods
Your custom TTS component must implement the following methods:synthesize(text: str, config: Optional[T]): Generate speech from text, returning an async iterator ofRasaAudioByteschunksengine_bytes_to_rasa_audio_bytes(chunk: bytes): Convert your engine’s audio format to Rasa’s audio formatfrom_config_dict(config: Dict): Class method to create an instance from configuration dictionaryget_default_config(): Static method that returns the default configuration for your component
Optional Methods
You may also override these methods as needed:connect(config: Optional[T]): Establish connection to the TTS engine if necessary. Default implementation does nothing.close_connection(): Custom cleanup when closing connections (e.g., closing websockets or HTTP sessions). Default implementation does nothing.send_text_chunk(text: str): Send text chunks to the TTS system for streaming synthesis. Used withstream_audio()for real-time streaming.signal_text_done(): Signal TTS engine to process any remaining buffered text and prepare to end the stream.stream_audio(): Stream audio output from the TTS engine. Continuously yields audio chunks as they are produced by the engine.
Streaming vs Non-Streaming TTS
The TTSEngine supports both streaming and non-streaming modes:- Non-streaming: Implement only
synthesize()method for simple request-response synthesis - Streaming: Set
streaming_input = Trueand implementsend_text_chunk(),signal_text_done(), andstream_audio()methods for real-time streaming synthesis
Required Class Attributes
You can optionally define these class attributes:required_env_vars: Tuple of required environment variable namesrequired_packages: Tuple of required Python package namesstreaming_input: Boolean indicating if the engine supports streaming input (defaults toFalse)
Example Implementation
Here’s an example of an implementation for TTS streaming:custom_tts.py
Configuration for Custom Components
To use a custom ASR or TTS component, you need to supply credentials for it in yourcredentials.yml file. The configuration should contain the module path of your custom class and any required configuration parameters.
The module path follows the format path.to.module.ClassName. For example:
- A class
MyASRin fileaddons/custom_asr.pyhas module pathaddons.custom_asr.MyASR - A class
MyTTSin fileaddons/custom_tts.pyhas module pathaddons.custom_tts.MyTTS
Custom ASR Configuration Example
credentials.yml
Custom TTS Configuration Example
credentials.yml
MyASRConfig or MyTTSConfig) can be passed through the credentials file and will be available in your component via self.config.