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

音频驱动与AEC驱动疑问

Open PawnMa opened this issue 11 months ago • 1 comments

目前box_audio_codec.cc中关于音频采样的设置如下

void BoxAudioCodec::EnableInput(bool enable) {
    if (enable == input_enabled_) {
        return;
    }
    if (enable) {
        esp_codec_dev_sample_info_t fs = {
            .bits_per_sample = 16,
            .channel = 4,
            .channel_mask = ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0),
            .sample_rate = (uint32_t)output_sample_rate_,
            .mclk_multiple = 0,
        };
        if (input_reference_) {
            fs.channel_mask |= ESP_CODEC_DEV_MAKE_CHANNEL_MASK(1);
        }
        ESP_ERROR_CHECK(esp_codec_dev_open(input_dev_, &fs));
        ESP_ERROR_CHECK(esp_codec_dev_set_in_channel_gain(input_dev_, ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0), 40.0));
    } else {
        ESP_ERROR_CHECK(esp_codec_dev_close(input_dev_));
    }
    AudioCodec::EnableInput(enable);
}

从原理图看出,通道1与通道2连接了麦克风,通道3进行了回采。但从代码上看,只用到了通道1,也没有用回采通道,而是用通道2作为回采通道,这边是否设置有误。

PawnMa avatar Mar 04 '25 06:03 PawnMa

原理图上的标号,跟驱动程序代码里的标号,可能不是一一对应关系,需要根据实际测试来调整。

78 avatar Mar 04 '25 12:03 78