Issue with Xiao Zhi AI switching to I2S audio input

Excuse me, I’d like to switch Xiaozhi’s audio input to I2S input to increase the microphone pickup distance. I’ve changed the default input path to I2S in Xiaozhi’s menuconfig, and modified the I2S to master mode in audio_server.c. Now the Xiaozhi wake word can be recognized, but there is no audio output. Resampling works fine and returns the correct number of bytes, but the audio write function returns 0. Additionally, if I enable pa.is_need_3a = 1;, it keeps printing 3a_w rbuf_far empty. Is this an issue? Need help.

while (!audio_mgr->is_online_exit) 
{
    ret = audio_write(audio_mgr->speaker, (uint8_t *)sifli_resample_get_output(audio_mgr->resample), resample_len);
    if (ret > 0) {
        break;
    }
    LOG_E("func: %s, speaker write failed error %d\n", __func__, ret);

    rt_thread_mdelay(10);
    if (retry ++ > 10) {
        rt_kprintf("func: %s, speaker write failed retry: %d, resample_len: %d\n", __func__, retry, resample_len);
        break;
    }
}


Which branch are you using? Refer to this and try modifying the I2S part.

The I2S flow hasn’t been thoroughly debugged. According to the log, when downlink data is sent to the speaker, it doesn’t reach audio_3a_far_put(). Check the call site of audio_3a_far_put() and figure out why it’s not being reached.

middleware/audio/audio_manager/audio_server.c · Sichuang Technology/SiFli-SDK - Gitee - Open Source China

It’s recommended to first get the I2S example working. Make sure the I2S based on the driver is functional before debugging the audio server.

https://gitee.com/SiFli/sifli-sdk/tree/main/example/rt_device/i2s