Skip to content

TTS Broadcast User's Guide*

1. Overview*

This article mainly describes the 8008C chip DAC output TTS voice broadcasting function.

2. SDK Download and Compilation Instructions*

2.1 Code Warehouse Download*

git clone git@gitlab.com:nationalchip/vsp_sdk.git

git checkout -b my_pri master //Switch to the main branch

2.2 Configuration file reference*

cp ./configs/nationalchip_public_version/8008c_wukong_v1.4_voice_play_wav_v2.0_demo.config .config cp ./configs/nationalchip_public_version/8008c_wukong_v1.4_voice_play_mp3_v2.0_demo.config .config

2.3 voice player v2.0 Functional Configuration Description*

VSP Basic Functions settings -> Enable Voice Player

Voice Player Type: DAC output audio type selection:wav,mp3

Specific decoder source code reference

./vsp/common/vsp_voice_player.c

2.4 TTS Broadcast Application Code Description*

2.4.1 voice player v2.0 Application Code Description*

VSP Customize Functions Settings -> Customize Functions Selection: (v2.0 for voice button demo)

This example simulates wake-up through the boot button, and after triggering wake-up, performs TTS voice broadcasting function.

Broadcast Interface Function:

int VspVoicePlayerPlay(int offset, unsigned int size, PLC_RESURCE_TYPE type); // offset: input data's address in flash

2.4.2 Sampling rate selection*

The current sampling rates supported by WAV and MP3 are as follows. In the example, the default sampling rate is 8k, which can be changed according to needs

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
typedef enum {
AUDIO_OUT_SAMPLE_RATE_48000 = 0x00,
AUDIO_OUT_SAMPLE_RATE_44100 = 0x01,
AUDIO_OUT_SAMPLE_RATE_32000 = 0x02,
AUDIO_OUT_SAMPLE_RATE_24000 = 0x03,
AUDIO_OUT_SAMPLE_RATE_22050 = 0x04,
AUDIO_OUT_SAMPLE_RATE_16000 = 0x05,
AUDIO_OUT_SAMPLE_RATE_11025 = 0x06,
AUDIO_OUT_SAMPLE_RATE_8000  = 0x07,
} AUDIO_OUT_SAMPLE_RATE;

tip

Due to decoder speed, MP3 currently only supports up to 32k

3. TTS voice broadcast file conversion instructions*

Use the following command to convert audio in WAV and MP3 formats into header files and call them on the application # include

xxd -i wozai.wav wozai.h

xxd -i wozaine.mp3 wozaine.h

tip

If the SRAM space allocated to the MCU is insufficient, XIP can be used. Please refer toXIP User Guide