xiaozhi-esp32 icon indicating copy to clipboard operation
xiaozhi-esp32 copied to clipboard

p3音效都无法播放

Open JohnnieFucker opened this issue 9 months ago • 8 comments

Answers checklist.

  • [x] I have read the documentation XiaoZhi AI Programming Guide and the issue is not addressed there.
  • [x] I have updated my firmware to the latest version and checked that the issue is present there.
  • [x] I have searched the issue tracker for a similar issue and not found a similar issue.

XiaoZhi AI firmware version.

v1.3.0

Operating System used.

macOS

How did you build your project?

VS Code IDE/Cursor

If you are using Windows, please specify command line type.

None

Power Supply used.

USB

What is the expected behavior?

正常播放各类p3文件音效

What is the actual behavior?

可以正常对话,但是没有播放各种p3文件的音效,有一个W (216689) Application: Server sample rate 16000 does not match device output sample rate 24000, resampling may cause distortion

Steps to reproduce.

  1. Step
  2. Step
  3. Step ...

Debug Logs.


More Information.

No response

JohnnieFucker avatar Feb 28 '25 01:02 JohnnieFucker

P3音频转换参考:https://icnynnzcwou8.feishu.cn/wiki/I5Mfw6USWivlRYk5yzzc3nC0nCg

Kevincoooool avatar Feb 28 '25 02:02 Kevincoooool

我是值的项目原有音效也无法播放

JohnnieFucker avatar Feb 28 '25 09:02 JohnnieFucker

我发现application.cc 的OnWakeWordDetected 里面如果调用 Alert就不能播放 但是在wifi_boards.cc 里面 application.Alert 就可以正常播放,是因为OnWakeWordDetected的处理是异步的原因么?

JohnnieFucker avatar Mar 07 '25 07:03 JohnnieFucker

可能是后面的设置设备状态为 Listening 的时候ResetDecoder,清空了音频缓冲区导致的。 你试试把那一行改为 SetDeviceState(kDeviceStateIdle);

78 avatar Mar 07 '25 09:03 78

可能是后面的设置设备状态为 Listening 的时候ResetDecoder,清空了音频缓冲区导致的。 你试试把那一行改为 SetDeviceState(kDeviceStateIdle);

测试不行,我还尝试过在alert后面加一个vTaskDelay(pdMS_TO_TICKS(30000));,都无法播放出音频。感觉还是Schedule异步的问题。

JohnnieFucker avatar Mar 13 '25 02:03 JohnnieFucker

Schedule里面的函数,是由main loop线程执行的,这个线程负责音频输入输出和网络通信,不可以进行delay操作的

78 avatar Mar 13 '25 04:03 78

那有什么办法呢?我试过SetDeviceState(kDeviceStateIdle);不行

JohnnieFucker avatar Mar 19 '25 10:03 JohnnieFucker

Alert不可以放在Schedule内部。

78 avatar Mar 19 '25 16:03 78