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

fix: 解决行空板df-k10麦克风收音太小的问题

Open nbzx opened this issue 9 months ago • 5 comments

Fixes 78/xiaozhi-esp32#350

nbzx avatar Mar 17 '25 02:03 nbzx

区别是什么?把一路输入的修改,变成全部输入的修改?

78 avatar Mar 17 '25 06:03 78

哦,我才发现原本注释掉的那一行是单路调整增益对吧: // ESP_ERROR_CHECK(esp_codec_dev_set_in_channel_gain(input_dev_, ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0), 40.0)); 我去掉注释测试过,启动有报错: `I (733) I2S_IF: channel mode 2 bits:16/16 channel:4 mask:3 I (743) I2S_IF: TDM Mode 0 bits:16/16 channel:4 sample_rate:24000 mask:3 I (753) I2S_IF: channel mode 0 bits:16/16 channel:4 mask:3 I (753) I2S_IF: STD Mode 1 bits:32/32 channel:4 sample_rate:24000 mask:0 I (763) Adev_Codec: Open codec device OK ESP_ERROR_CHECK failed: esp_err_t 0x106 (ESP_ERR_NOT_SUPPORTED) at 0x4201c06a --- 0x4201c06a: K10AudioCodec::EnableInput(bool) at /Users/nbzx/Developer/esp32/xiaozhi-esp32/main/boards/df-k10/k10_audio_codec.cc:179 (discriminator 2)

file: "./main/boards/df-k10/k10_audio_codec.cc" line 179 func: virtual void K10AudioCodec::EnableInput(bool) expression: esp_codec_dev_set_in_channel_gain(input_dev_, ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0), 40.0) abort() was called at PC 0x4038521b on core 0 --- 0x4038521b: _esp_error_check_failed at /Users/nbzx/Developer/esp32/v5.3.2/esp-idf/components/esp_system/esp_err.c:49 Backtrace: 0x40379fda:0x3fcb2fb0 0x40385225:0x3fcb2fd0 0x4038d915:0x3fcb2ff0 0x4038521b:0x3fcb3060 0x4201c06a:0x3fcb3090 0x4200cdb6:0x3fcb30c0 0x42013766:0x3fcb3160 0x42017061:0x3fcb33c0 0x421afe57:0x3fcb33e0 0x40385dd5:0x3fcb3410`

nbzx avatar Mar 17 '25 09:03 nbzx

esp_codec_dev_set_in_channel_gain

如果取消注释,就不能正常跑了。

HonestQiao avatar Mar 17 '25 11:03 HonestQiao

亲测esp-box-lite中也有用,麻烦在合pr时,也把esp-box-lite也给应用下。。

mtdxc avatar Mar 17 '25 13:03 mtdxc

验证了一下,可行。

ES7210:

    codec->base.set_mic_gain = es7210_set_gain;
    codec->base.set_mic_channel_gain = es7210_set_channel_gain;

ES7243E:

codec->base.set_mic_gain = es7243e_set_gain;

除了ES7210有set_mic_channel_gain,其他的如ES7243E都只有set_mic_gain。 所以这个地方的增益,应该用esp_codec_dev_set_in_gain()。

HonestQiao avatar Mar 17 '25 13:03 HonestQiao