Skip to content

1. Obtain MP3 Files

  • First, create the prompt sound
    • Recommended website: None for now, you can search for MP3 audio resources online
  • Format requirements:
    • Sample rate: 16KHz
    • Channel: Mono
  • Prompt sound list, the file path: aipi-palchat_v2/doubao/lib/axk_app/tone.h

The names of the prompt sounds must not be changed, otherwise subsequent steps may fail!

No.Prompt Sound Array NameExample Content
1tone_wozaiI'm here
2tone_weipeiwangI am your AI voice assistant. Please say: Hello Xiaoan. Start network configuration
3tone_kaishipeiwangEntering network configuration mode, please use the Ai-Thinker Mini Program or App to configure
4tone_peiwangshibaiNetwork configuration timeout, please try again
5tone_peiwangchenggongNetwork configuration successful
6tone_lianwangchenggongNetwork connected successfully
7tone_wangluoduankaiNetwork error, reconnecting
8tone_lianwangzhongConnecting to network
9tone_lianwangshibaiNetwork connection failed
10tone_yipeiwangI am your AI voice assistant. Please say: Hello Xiaoan. Wake me up
11tone_tuixiaExit

2. Audio Conversion

For your convenience, we provide a Python script that batch converts an MP3 folder to a C header file in Opus format (16kHz sample rate, mono). This script uses ffmpeg for format conversion. Please install the required dependencies before running.

▫️Script Environment Installation

  • Install python3. If already installed, skip. Use python --version to check.
shell
sudo apt-get install python3
  • Install ffmpeg and opus encoder
shell
sudo apt-get install ffmpeg libopus0 libopus-dev

▫️Script Usage

  • Enter the MP3_Conversion folder
shell
cd MP3_Conversion
  • Run the script
shell
./mp3_to_opus.py  northeast_sister/ -o northeast_sister/tone.h

This command runs batch_mp3_to_opus_header_simplified.py. The first argument is the audio folder, the second is the output file path and name.

(Click to view) Success Example
(Click to view) The script outputs a .h file in the specified format
  • Replace the original file
shell
cp northeast_sister/tone.h aipi-palchat_v2/doubao/lib/axk_app/tone.h

3. Build and Test

▫️Enter boubao directory

shell
cd ../doubao

▫️Build

shell
make

▫️Flash

shell
make flash COMX=/dev/ttyACM0

COMX is the serial port name, please modify according to your actual situation

4. Issues and Solutions

(Click to view) Error when installing opuslib and numpy libraries

Installation errors due to environment issues can be resolved as follows。

  • Install python virtual environment tool
shell
sudo apt install python3-venv
  • Create a virtual environment (e.g. in the project directory)
shell
python3 -m venv myenv
  • Activate the virtual environment
shell
source myenv/bin/activate
  • Reinstall dependencies
shell
pip3 install ffmpeg-python pydub numpy opuslib

Released under the MIT License.