Welcome to RDK X5 Board repository
05. AI Voice Interaction Configuration
OpenClaw AI Voice Interaction Configuration
OpenClaw AI Voice Interaction Configuration1. Course Overview2. Overall Voice Interaction Pipeline3. Voice Configuration File Description3.1 Configuration File Location3.2 Minimum Configuration to Check Before Startup4. Key Parameter Description4.1 Voice Recognition Engine4.2 Microphone and Speaker Devices4.3 DashScope Authentication and ASR Model4.4 TTS Voice Broadcast Configuration4.5 OpenClaw Gateway Configuration Reference4.6 Serial Port Wake-up Configuration4.7 Steps to Switch Between Chinese and English5. Starting Voice Interaction5.1 Prepare Virtual Environment5.2 Startup Method5.3 If Other Interaction Methods Need Broadcasting6. Configuration Verification Methods6.1 Verify if Voice Program Can Start6.2 Verify Recognition and Publishing Process6.4 Verify TTS [Optional]7. Common Issues7.1 Program Startup Failure7.2 No Recognition Result After Wake-up7.3 Recognition Successful but OpenClaw No Response7.4 Can Recognize but No Sound Broadcast7.5 Serial Port Wake-up Failure8. Recommended Debugging Order
1. Course Overview
This course will introduce how to configure the AI voice interaction pipeline in OpenClaw, including the location of voice configuration files, descriptions of key parameters, startup methods, and troubleshooting for common issues.
After completing this course, you will be able to:
- Know which configuration file is used for AI voice interaction
- Understand the meaning of key parameters in
.env - Master the method to switch between Chinese and English voice recognition
- Correctly start the voice program
2. Overall Voice Interaction Pipeline
The current voice interaction flow in OpenClaw can be simply understood as:
- Microphone captures voice
- Program performs silence detection and segmentation
- ASR engine converts voice to text
- Recognition results are published to OpenClaw
- OpenClaw returns results
[Optional]TTS broadcasts the returned results (you can choose whether to broadcast as replies can be very long)
The core configuration file for this pipeline is:
/home/sunrise/voice_to_openclaw/.env3. Voice Configuration File Description
3.1 Configuration File Location
Default uses the accompanying factory image
xxxxxxxxxx/home/sunrise/voice_to_openclaw/.envIf this file does not exist, you can copy it from the template first:
xxxxxxxxxxcd /home/sunrise/voice_to_openclawcp .env.example .env3.2 Minimum Configuration to Check Before Startup
It is recommended to confirm at least the following items:
ASR_ENGINEDASHSCOPE_API_KEYDASHSCOPE_LANGUAGEorXUNFEI_ASR_LANGUAGEDEVICESPEAKER_DEVICEOPENCLAW_CONFIG_PATHENABLE_SERIAL_WAKE
4. Key Parameter Description
4.1 Voice Recognition Engine
xxxxxxxxxxASR_ENGINE=dashscopeCurrently supports three modes:
dashscope: Tongyi Bailian native voice recognition interface, suitable for direct online usexunfei_ws: iFlytek WebSocket voice recognition, suitable for overseas version configurationfaster_whisper: Local Whisper recognition, suitable for local operation (not supported by RDK)
4.2 Microphone and Speaker Devices
xxxxxxxxxxDEVICE=0SPEAKER_DEVICE=0These two parameters determine which audio input and output devices the program uses.
Suitable scenarios for modification:
- Multiple microphone devices
- USB microphone is not the system default device
- Speaker output is directed to the wrong device
If the voice program starts but you cannot hear sound or record sound, check here first.
4.3 DashScope Authentication and ASR Model
Apply for an API key by logging into Alibaba Cloud Bailian.
Link: Large Model Service Platform Bailian Console

xxxxxxxxxxDASHSCOPE_API_KEY=DASHSCOPE_API_URL=https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generationDASHSCOPE_ASR_MODEL=qwen3-asr-flashWhere:
DASHSCOPE_API_KEY: Must fill in a valid API-KEYDASHSCOPE_API_URL: Default is already providedDASHSCOPE_ASR_MODEL: Default voice recognition model
If this is not configured correctly, common phenomena include:
- Recognition fails after program startup
- Returns authentication error
- Voice recognition request times out or reports model error
4.4 TTS Voice Broadcast Configuration
xxxxxxxxxxENABLE_TTS=falseWAKE_ACK_TEXT=I am here.If you want voice broadcast after voice recognition, you can enable it:
xxxxxxxxxxENABLE_TTS=trueCurrent common TTS parameters include:
DASHSCOPE_TTS_MODELDASHSCOPE_TTS_VOICEDASHSCOPE_TTS_VOLUMEDASHSCOPE_TTS_SPEECH_RATE
It is recommended to get ASR working first before considering enabling TTS.
4.5 OpenClaw Gateway Configuration Reference
xxxxxxxxxxOPENCLAW_CONFIG_PATH=~/.openclaw/openclaw.jsonOPENCLAW_TIMEOUT=70 # Maximum retry time, waiting for OpenClaw response. If it's a long task, it is recommended to increase this time.OPENCLAW_RETRY=1This part of the configuration determines how the voice program sends recognition results to OpenClaw.
By default:
- The program reads
openclaw.json - Automatically derives the local gateway port
- Automatically reads the gateway authentication token
Therefore, if voice recognition is successful but OpenClaw does not execute instructions, check here first.
4.6 Serial Port Wake-up Configuration
xxxxxxxxxxENABLE_SERIAL_WAKE=trueMIC_SERIAL_PORT=/dev/ttyUSB0MIC_SERIAL_BAUDRATE=115200SERIAL_WAKE_REQUIRED=trueIf you are using the accompanying voice module, serial port wake-up mode is usually adopted.
The main functions are:
- Wait for wake-up signal normally
- Start capturing the next segment of voice upon receiving wake-up
- Return to waiting state after processing is complete
If you do not have the accompanying serial port wake-up module, you can adjust as needed:
xxxxxxxxxxENABLE_SERIAL_WAKE=false4.7 Steps to Switch Between Chinese and English
If you need to switch voice interaction from Chinese to English, it is recommended to directly modify the language parameters in .env and then restart the program.
Currently, voice_to_openclaw/.env enables the Domestic Version (Bailian) by default.
Method 1: Overseas Version (iFlytek International Edition)
Main configuration items:
xxxxxxxxxxXUNFEI_ASR_LANGUAGE=en_cnXUNFEI_ASR_ACCENT=mandarin- Chinese recognition:
XUNFEI_ASR_LANGUAGE=zh_cn - English recognition:
XUNFEI_ASR_LANGUAGE=en_us - When the recognition language is changed to English,
XUNFEI_ASR_ACCENTis no longer needed; it can be commented out or left with its original value unused.
Example:
x# Chinese recognitionXUNFEI_ASR_LANGUAGE=zh_cnXUNFEI_ASR_ACCENT=mandarin# English recognitionXUNFEI_ASR_LANGUAGE=en_us# XUNFEI_ASR_ACCENT=mandarinIf TTS is also enabled and you want English broadcast, you also need to change TTS_VOICE to an English voice you have activated; if you just want to verify English recognition first, only change the ASR language.
Method 2: Domestic Version (Bailian)
Main configuration items:
xxxxxxxxxxDASHSCOPE_LANGUAGE=zh- Chinese recognition:
DASHSCOPE_LANGUAGE=zh - English recognition:
DASHSCOPE_LANGUAGE=en
Example:
xxxxxxxxxx# Chinese recognitionDASHSCOPE_LANGUAGE=zhIf the Bailian solution also enables TTS, it is recommended to switch to the corresponding English voice simultaneously; otherwise, you may encounter a situation where English recognition is normal, but the broadcast still has a Chinese accent.
After modification, re-execute the startup command below to take effect.
5. Starting Voice Interaction
5.1 Prepare Virtual Environment
This step is not required for the factory image. If dependencies are not yet installed, execute first:
xxxxxxxxxxcd /home/sunrise/voice_to_openclawpython3 -m venv .venvsource .venv/bin/activatepip install -r requirements.txt5.2 Startup Method
xxxxxxxxxxcd /home/sunrise/voice_to_openclawsource .venv/bin/activatepython -m src.mainIf startup is successful, the program will enter a state of waiting for wake-up or waiting for voice input.
5.3 If Other Interaction Methods Need Broadcasting
- Change the broadcast parameter configuration to True
xxxxxxxxxxENABLE_TTS=true - Additionally start an independent listener, enter in terminal:
xxxxxxxxxxcd ~/voice_to_openclawsource .venv/bin/activatepython -m src.openclaw_session_tts
6. Configuration Verification Methods
6.1 Verify if Voice Program Can Start
Execute:
xxxxxxxxxxcd /home/sunrise/voice_to_openclawsource .venv/bin/activatepython -m src.mainIf the program starts successfully without immediate errors, the basic environment is likely normal.
6.2 Verify Recognition and Publishing Process
Say "Hello, Xiao Ya" to wake up, then try saying:
- Tell me a joke
- Display "Hello" on the OLED
If you can see OpenClaw return text, it means:
- Microphone capture is normal
- ASR is normal
- OpenClaw gateway publishing is normal

6.4 Verify TTS [Optional]
If enabled:
xxxxxxxxxxENABLE_TTS=trueThen after OpenClaw returns results, you should be able to hear voice broadcast.
7. Common Issues
7.1 Program Startup Failure
Check first:
- Whether
.venvexists - Whether dependencies are installed
- Whether
.envexists
7.2 No Recognition Result After Wake-up
Check first:
- Whether
ASR_ENGINEis configured correctly - Whether
DASHSCOPE_API_KEYis valid - Whether microphone device number
DEVICEis correct
7.3 Recognition Successful but OpenClaw No Response
Check first:
- Whether
OPENCLAW_CONFIG_PATHis correct - Whether the gateway port in
openclaw.jsonis normal - Whether the OpenClaw gateway is started
7.4 Can Recognize but No Sound Broadcast
Check first:
- Whether
ENABLE_TTSistrue - Whether
SPEAKER_DEVICEis correct - Whether the speaker is connected normally
7.5 Serial Port Wake-up Failure
Check first:
- Whether
ENABLE_SERIAL_WAKEistrue - Whether
MIC_SERIAL_PORTis correct - Whether
MIC_SERIAL_BAUDRATEis correct - Whether the voice module serial device is recognized by the system
8. Recommended Debugging Order
It is recommended to troubleshoot the voice pipeline in the following order:
- First confirm the
.envfile exists - Then confirm
DASHSCOPE_API_KEYis filled in - Start the program to confirm no immediate errors
- Check if wake-up is effective
- Check if recognition is effective
- Check if OpenClaw receives text
- Finally check TTS broadcast