如需更换 TTS 回复音频,按以下步骤操作。

准备音频

  • 格式要求:MP3

  • 目录结构:

    tts_mp3/              <-- -dir 参数指定此目录
    └── tts/
        ├── 10001.mp3    # 唤醒回复音
        ├── 10002.mp3    # 超时退出回复音
        ├── x.mp3        # 命令词回复音(x 为命令词序号)
        └── angle/       # (可选)声源定位角度回复音
            ├── 1000.mp3
            └── ...

    备注

    打包命令中的 -dir 参数需使用最外层目录 tts_mp3,而非 tts 目录本身。

  • 音频命名规则:文件名对应 ${download}/patch/component/application/speechmind/src/speech_tts.c 中的 tts_content_name 第二列。

    static const struct tts_content_name tts_names[] = {
        {"主人我在", "10001"},
        {"主人我先退下啦有需要请再唤醒我", "10002"},
        {"命令 1 已执行", "1"},
        {"命令 2 已执行", "2"},
        ...
    };
  • 如已开启声源定位功能,还需将角度回复音频目录拷贝至 tts 目录下:

    cp -r ${SDK}/component/application/speechmind/res/tts/tts/angle tts_mp3/tts

打包音频

python ${SDK}/tools/image_scripts/vfs.py -t LITTLEFS -s 4096 -c 1024 -dir tts_mp3 -out tts.bin
  • -dir 参数必须使用包含 tts 子目录的 最外层目录 (如示例中的 tts_mp3),而非 tts 目录本身。打包后 bin 文件中的 tts 目录需与代码播放路径 tts/xxx.mp3 保持一致。

  • 如提示 "size exceed limit",表示音频总大小超过 4M 限制,需降低 MP3 音频的比特率以减小文件体积。

  • 打包后 tts.bin 烧录地址请参考各芯片固件烧录章节。默认大小 4M(-c 1024),如需调整请去掉 -c 参数并参考 AIVoice 开发指南 示例二配置 layout。