forked from xiaozhi/xiaozhi-esp32
Fix custom wakeword for dual mic (#1018)
This commit is contained in:
@@ -524,6 +524,11 @@ void AudioService::EnableAudioTesting(bool enable) {
|
|||||||
|
|
||||||
void AudioService::EnableDeviceAec(bool enable) {
|
void AudioService::EnableDeviceAec(bool enable) {
|
||||||
ESP_LOGI(TAG, "%s device AEC", enable ? "Enabling" : "Disabling");
|
ESP_LOGI(TAG, "%s device AEC", enable ? "Enabling" : "Disabling");
|
||||||
|
if (!audio_processor_initialized_) {
|
||||||
|
audio_processor_->Initialize(codec_, OPUS_FRAME_DURATION_MS);
|
||||||
|
audio_processor_initialized_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
audio_processor_->EnableDeviceAec(enable);
|
audio_processor_->EnableDeviceAec(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,10 +133,8 @@ private:
|
|||||||
std::deque<std::unique_ptr<AudioStreamPacket>> audio_testing_queue_;
|
std::deque<std::unique_ptr<AudioStreamPacket>> audio_testing_queue_;
|
||||||
std::deque<std::unique_ptr<AudioTask>> audio_encode_queue_;
|
std::deque<std::unique_ptr<AudioTask>> audio_encode_queue_;
|
||||||
std::deque<std::unique_ptr<AudioTask>> audio_playback_queue_;
|
std::deque<std::unique_ptr<AudioTask>> audio_playback_queue_;
|
||||||
|
|
||||||
// For server AEC
|
// For server AEC
|
||||||
std::deque<uint32_t> timestamp_queue_;
|
std::deque<uint32_t> timestamp_queue_;
|
||||||
std::mutex timestamp_mutex_;
|
|
||||||
|
|
||||||
bool wake_word_initialized_ = false;
|
bool wake_word_initialized_ = false;
|
||||||
bool audio_processor_initialized_ = false;
|
bool audio_processor_initialized_ = false;
|
||||||
|
|||||||
@@ -80,9 +80,20 @@ void CustomWakeWord::Feed(const std::vector<int16_t>& data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StoreWakeWordData(data);
|
esp_mn_state_t mn_state;
|
||||||
|
// If input channels is 2, we need to fetch the left channel data
|
||||||
|
if (codec_->input_channels() == 2) {
|
||||||
|
auto mono_data = std::vector<int16_t>(data.size() / 2);
|
||||||
|
for (size_t i = 0, j = 0; i < mono_data.size(); ++i, j += 2) {
|
||||||
|
mono_data[i] = data[j];
|
||||||
|
}
|
||||||
|
|
||||||
esp_mn_state_t mn_state = multinet_->detect(multinet_model_data_, const_cast<int16_t*>(data.data()));
|
StoreWakeWordData(mono_data);
|
||||||
|
mn_state = multinet_->detect(multinet_model_data_, const_cast<int16_t*>(mono_data.data()));
|
||||||
|
} else {
|
||||||
|
StoreWakeWordData(data);
|
||||||
|
mn_state = multinet_->detect(multinet_model_data_, const_cast<int16_t*>(data.data()));
|
||||||
|
}
|
||||||
|
|
||||||
if (mn_state == ESP_MN_STATE_DETECTING) {
|
if (mn_state == ESP_MN_STATE_DETECTING) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n
|
|||||||
# Fix ML307 FIFO Overflow
|
# Fix ML307 FIFO Overflow
|
||||||
CONFIG_UART_ISR_IN_IRAM=y
|
CONFIG_UART_ISR_IN_IRAM=y
|
||||||
|
|
||||||
|
# Fix ESP_SSL error
|
||||||
|
CONFIG_MBEDTLS_SSL_RENEGOTIATION=n
|
||||||
|
|
||||||
# LVGL 9.2.2
|
# LVGL 9.2.2
|
||||||
|
|
||||||
CONFIG_LV_OS_NONE=y
|
CONFIG_LV_OS_NONE=y
|
||||||
|
|||||||
Reference in New Issue
Block a user