Skip to content

Conversation

@kahrendt
Copy link
Contributor

This is an experimental firmware for testing purposes only, do not merge!

The audio fed into microWakeWord does not use the XMOS's Automatic Gain Control (AGC) algorithm as it interferes with mWW's own autogain. mWW's autogain works only on short timescales, but it does seem beneficial for wake word accuracy to increase the gain of the incoming audio on longer timescales.

This experimental firmware attempts to find the noise floor of the room by comparing the peak and RMS sound levels. If they are close enough, then we assume the RMS value is the noise floor. This PR attempts to tune the gain factor, in the long term, so that the RMS value matches the target RMS level. This is meant to be a slow tuning effect, so it won't rapidly change or even change at all while there are loud noises in the room. It should settle near the target RMS level once the sound levels are stable for long periods of time. Note that it will log gain factor adjustments in case you are monitoring them.

This exposes 4 new entities in Home Assistant: a switch enabling or disabling the new algorithm, a number entity allowing you to configure the target RMS level, and two sensors reporting the peak and RMS sound levels for the mWW audio.

For anyone testing this firmware, we are interested in the following questions (though other observations are also encouraged!):

  • Do you experience more or less false rejections; e.g., you say the wake word but the device doesn't activate
  • Do you experience more or less false accepts; e.g., you don't say the wake word but the device activates
  • Does changing the target RMS value change the results for the previous two questions? It defaults to -75 dB, but this was just a random chosen starting point!

@github-actions
Copy link

Firmware built successfully! 🎉

Download and extract the firmware to install with https://web.esphome.io

Make sure to choose home-assistant-voice-esp32s3.factory.bin.

@github-actions
Copy link

Firmware built successfully! 🎉

Download and extract the firmware to install with https://web.esphome.io

Make sure to choose home-assistant-voice-esp32s3.factory.bin.

@andreasbrett
Copy link
Contributor

andreasbrett commented May 30, 2025

I've been testing it for a few days. I haven't had to tweak the target RMS value so far. I see that the gain is adjusted (when the radio is on it is at 2, when it is quiet it is at 6) but I haven't noticed any improvement of the wake word detection. To be honest it was already working well for me before this PR. But at least I can contribute that this change does not make things worse.

I use "okay Nabu" and have sensitivy on "slightly sensitive" (old default).

@andreasbrett
Copy link
Contributor

I have disabled it again. Detection rates got worse when I upped the threshold. I could not find a setting where it worked better than without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants