一、说明
运行duomotai_ap sdk下的shell_xtts例程,测试语音合成以及SPK功能。
操作说明:开发指南 | 聆思文档中心 (listenai.com)
与处理器的信号连接:
二、工程
1、设备树
由于AI-Talk开发板与CSK6-MIX开发板有些管脚不一样,所以在duomotai_ap/.sdk/csk/boards/arm/目录下新建一个目录csk6_duomotai_ai_talk,将csk6_duomotai_devkit目录下的所有文件拷贝到csk6_duomotai_ai_talk目录下,然后修改文件的内容,适配AI-Talk开发板。
在duomotai_ap/apps/shell_xtts/boards/目录下新建csk6_duomotai_ai_talk.overlay文件,内容:
/** Copyright (c) 2021 listenai Intelligent Technology (anhui) Co., Ltd.** SPDX-License-Identifier: Apache-2.0*//delete-node/ &storage_partition;/* 删除掉系统dts默认配置的参数 */
/delete-node/ &psram_ap;
/delete-node/ &psram_cp;
/delete-node/ &psram_share;
/delete-node/ &wifi_driver_storage;
/delete-node/ &wifi_nvs_storage;/ {chosen {zephyr,code-partition = &ap_code_partition;resource,cp = &cp_code_partition;resource,xtts_front = &xtts_front_partition;resource,xtts_role = &xtts_role_partition;resource,xtts_rear = &xtts_rear_partition;resource,xtts1_role = &xtts_role1_partition;resource,xtts1_rear = &xtts_rear1_partition;};aliases {spk-pa-mute = &spk_pa_mute;};leds {compatible = "gpio-leds";spk_pa_mute: spk_pa_mute {gpios = <&exgpioc 2 GPIO_ACTIVE_HIGH>;};};};&flash0 {/** For more information, see:* http: //docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions*/reg = <0x18000000 DT_SIZE_M(16)>;write-block-size = <4>;partitions {compatible = "fixed-partitions";#address-cells = <1>;#size-cells = <1>;};partitions {ap_code_partition: partition@0 {label = "ap_code";reg = <0x00000 0x200000>;};cp_code_partition: partition@200000 {label = "cp_code";reg = <0x200000 0x200000>;};xtts_front_partition: partition@400000 {label = "resource_xtts_front";reg = < 0x400000 0x327e85>;};xtts_role_partition: partition@800000 {label = "resource_xtts_role";reg = < 0x800000 0xa02>;};xtts_rear_partition: partition@810000 {label = "resource_xtts_rear";reg = < 0x810000 0x366f90>;};xtts_role1_partition: partition@C00000 {label = "resource_xtts_role1";reg = < 0xC00000 0xa02>;};xtts_rear1_partition: partition@C10000 {label = "resource_xtts_rear1";reg = < 0xC10000 0x366f90>;};};
};&psram0{compatible = "listenai,csk6-psram";reg = <0x30000000 0x800000>;#label = "psram0";#address-cells = <0x1>;#size-cells = <0x1>;psram_cp: psram_cp@30000000 {compatible = "listenai,csk6-psram-partition";reg = <0x30000000 0X700000>;status = "okay";};psram_ap: psram_ap@30510000 {compatible = "zephyr,memory-region","listenai,csk6-psram-partition";reg = <0x30700000 0x100000>;status = "okay";zephyr,memory-region = "PSRAMAP";};
};
2、编译
cd到duomotai_ap目录,执行编译命令:
lisa zep build -b csk6_duomotai_ai_talk apps/shell_xtts -p
编译生成的固件:duomotai_ap/build/zephyr/zephyr.bin
三、烧录
固件的烧录及查看运行日志参照:AI-Talk开发板CSK6固件烧录-CSDN博客
四、授权
由于语音合成功能需要离线算法授权,所以需要向聆思申请license,并将license烧录到FLASH,地址为0xfff000。
授权内容如下:
大部分应用功能都需要授权才能使用。
五、运行
1、启动
程序运行后,可听到开发套件播放 “你好” 的合成音频。
启动日志:
uart:~$ [00:00:00.000,000] <inf> csk6_spi: SPI REG ADDR:0x45500000
[00:00:00.000,000] <inf> csk6_spi: SPI REG ADDR:0x45400000
[00:00:00.000,000] <inf> csk6_exmcu_i2c: exmcu addr:0x6C
[00:00:00.041,000] <inf> csk6_exmcu_i2c: exmcu info, chip type:ch32v003, ver:1.3
[00:00:00.041,000] <inf> display_st7789v: st7789v_init
[00:00:00.062,000] <dbg> display_st7789v: st7789v_reset_display: Resetting display
[00:00:00.220,000] <inf> display_st7789v: st7789v_init done
*** Booting Zephyr OS build zephyr-v3.4.0-63-g0de75cc2e493 ***
*** ListenAI CSK SDK Version: 2.0.0.0-ca91a4e08a ***
*** Duomotai SDK Version: 2.0.2 build: v2.0.2-beta-dirty ***
[00:00:00.222,000] <inf> boot_cp: CP XIP start addr (0x68200000)
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet wait ...
ic_message_connet ok
[00:00:02.418,000] <inf> comp_xtts: base_speed:100, mode:2
[00:00:02.418,000] <inf> comp_xtts: voice speed:0, rate:50.000000, base speed:100
[00:00:02.419,000] <inf> xtts_gcl: tts_text: addr: 你好, len: 6
[00:00:02.421,000] <inf> comp_xtts: TTS_AUDIO start
[00:00:03.511,000] <inf> comp_xtts: TTS_AUDIO finish
如果没有烧录license文件,不会等到"ic_message_connet ok"的消息。
2、播放指定内容
通过串口连接到电脑,使用在线串口工具发送内容给开发板。
在线工具:聆思在线串口终端 (listenai.com)
3、演示
大模型交互终端语音合成测试