Audio Quality Test

Last Updated on : 2025-04-21 09:50:37download

Voice interaction is a fundamental feature of AI hardware. The quality of audio data during interaction serves as the foundation for ensuring product functionality and user experience. It is also a prerequisite for accurate speech recognition and precise comprehension/response from large language models. Therefore, every AI hardware product requires audio quality tests.

Tuya provides basic audio data test methods to help you get audio data and adjust product structure, hardware, and software accordingly during the development process. Therefore, this ensures the quality of audio data, improves the wake-up rate and voice recognition rate, and optimizes the large model interaction experience.

Get data

Wukong AI Hardware Development Framework provides basic audio test methods. Taking tuyaos_demo_ai_toy as an example, follow the steps below:

  1. Enable the audio test feature. Modify tuya_ai_debug.h, and set TUYA_UPLOAD_DEBUG to 1.

    #define TUYA_UPLOAD_DEBUG 1
    
  2. Modify tuya_ai_debug.c and change the server IP address to that of the host software, which is usually the IP address of your test computer.

    #define TCP_SERVER_IP "192.168.32.160" // Change to the IP address of the computer where your host software is located
    #define TCP_SERVER_PORT 5055
    
  3. Copy scripts/ai_audio_proc.py in the project to windows and run the file.

    You need to install pyaudio.

    python ai_audio_proc.py
    
    Audio Quality Test
  4. Build the firmware, flash it to the device, run it, and start chatting. When picking up sound and uploading, the firmware will automatically upload the audio data of the acoustic echo cancellation (AEC) and voice activity detection (VAD) stages to the current script directory and play it. You can wear headphones to check the integrity of the voice data.

    Audio Quality Test

Analyze data

Use professional tools such as Ocenaudio to analyze audio data files and compare captured audio files.

Audio Quality Test

Optimize and adjust

Optimize hardware

Refer to Tuya’s hardware solutions and adjust the hardware structure. The following supporting hardware is recommended:

Optimize software — VAD

Currently, for audio parameters, it is only recommended to adjust the energy threshold of VAD. (It is too complicated to adjust other parameters, so they will be released to the public after being optimized.)

You can adjust the VAD energy threshold in parameter aud_voc_setup.aec_cfg.SPthr[0] in the tkl_audio.c file. It defaults to 2500, and can be adjusted within the range of 800 to 4000. The lower the value, the easier it is to trigger. For example, if you want to filter out the voices of people next to you, you can increase this threshold. If you want to receive sounds from afar, you can lower this value appropriately.

aud_voc_setup.aec_cfg.SPthr[0] = 2500;

Support and help

If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.