Hi everyone,
I’m currently working on a horror game where the enemy AI (I’m using LimboAI) listens to the player’s real-life microphone. I want the monster to detect when the player makes too much noise in real life (like talking, coughing, or hitting the keyboard).
I know that I need to route an AudioStreamMicrophone to a muted Audio Bus to prevent audio feedback loop. However, I’m a bit confused about the best coding approach to actually read the volume levels in _process(delta).
Should I use AudioServer.get_bus_peak_volume_left_db() to get the decibels, or is it better to use AudioEffectSpectrumAnalyzer to get the magnitude for a specific frequency range (to filter out background static)?
If anyone has experience with this kind of mechanic or a solid code snippet for reading microphone levels without tanking performance, I would really appreciate the help!
Thanks in advance!