Audio
In the C202 SDK, what is the difference between audio_player_stop_and_wait, audio_player_stop_speak, and audio_player_raw_write_finish in the CI1302 audio flow?
audio_player_raw_write_finish: indicates the end of audio delivery, that is, the end of a data stream such as streaming TTS.audio_player_stop_speak: quickly responds to an asynchronous stop request, similar to pausing by key press.audio_player_stop_and_wait: forcibly stops playback and blocks until the stop is complete, for example when wake-up interrupts playback.
While using C202, the error ci13002_protocol: Deal recv frame too slow appears. What does it mean?
This error is triggered when xQueueSend cannot push the received frame data into the queue within the 10 ms timeout.
It means the uart_buffer_queue is full. Common causes include:
- The consumer is too slow. In
ci1302.c, theci1302_deal_task()task cannot dequeue and process data as fast as the UART receives it. - The queue depth is too small, so it fills up during bursts of incoming data.
- The consumer task is blocked by other operations such as file access or network requests and cannot dequeue data in time.
- The CI1302 sends a burst of data in a short time, such as audio streams or wake-up events, exceeding the current processing capacity.
How can AMR recording data be buffered in PSRAM first and then written to SPI flash when needed?
You can allocate a PSRAM buffer with heap_caps_malloc(size, MALLOC_CAP_SPIRAM) and write the AMR recording data into that buffer first.
After recording ends, or once the write condition is met, write the buffered data to SPIFFS/Flash either all at once or in chunks. This reduces frequent flash writes and improves the recording storage flow.
After changing the wake word on C302, how can the power-on prompt “I am Xiaoming” be disabled? Does the platform support custom wake words and acoustic-model upgrades?
To disable the power-on prompt, refer to chat_notify_list.c. This file contains multiple built-in local audio identifiers. Find the entry corresponding to “Ni Hao Xiao Ming”, then trace where the matching identifier header is invoked and disable that call.
The actual playback function is chat_notify_audio_play().
As for wake words and models, online acoustic-model upgrades are currently not supported:
- Only the model matching the current solution can be used, and the model itself cannot be upgraded over OTA.
- If the model must be upgraded, it can only be upgraded manually over UART.
- If you use UART-based upgrade, you also need to disable the
ota1302-related functionality in the SDK.
How can multiple MP3 files be packed into a .bin file stored in Flash and played on demand?
Refer to the ESP-ADF examples/player/pipeline_flash_tone example. This flow uses a script to pack multiple MP3 files into audio-esp.bin, which can be flashed to Flash, and assigns a fixed Flash path to each audio file, such as flash://tone/0_Bt_Reconnect.mp3.
Basic flow:
- Put the source MP3 files into the
tone_mp3_folderdirectory. - Run
$ADF_PATH/tools/audio_tone/mk_audio_tone.pyand specify the source audio directory. - The script generates a
.csource file, a.henum header, and the flashableaudio-esp.binfile. - The application references the desired audio path through the enum index, then decodes and plays the selected MP3 through the ESP-ADF Pipeline.
This approach is suitable for prompts, offline voice resources, key tones, and other fixed audio assets.
Can an ESP32-S3 module implement echo cancellation with software only, without a dedicated AEC hardware circuit?
Yes. As long as the software can provide the correct microphone signal and playback reference signal, echo cancellation can be implemented with Espressif's software AEC algorithm without a dedicated AEC hardware circuit.
However, AEC quality depends not only on the software algorithm, but also on hardware and acoustic design factors, such as:
- Speaker distortion
- Microphone noise
- Reference signal path delay
- Device acoustic cavity and microphone/speaker placement
Therefore, product design still needs reasonable hardware layout and acoustic structure. Otherwise, software AEC may still leave residual echo or behave unstably.