From bf6932ecb79e8fdab73505dddd147f442121afb8 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Fri, 5 Apr 2024 14:57:55 +0200 Subject: [PATCH] ar_energy: reduced zeroCrossingCount magnitude by 1/3 zero crossing counter is often larger than in the prototype by @troyhacks - due to calculation after filtering (catches more crossings), and due to the fixed condition for detecting zero crossings (doubles the number of crossings). This patch reduces the final value to 2/3, so it typically stays below 256. --- usermods/audioreactive/audio_reactive.h | 1 + 1 file changed, 1 insertion(+) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 070fba00..402ad29e 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -563,6 +563,7 @@ void FFTcode(void * parameter) } } } + newZeroCrossingCount = (newZeroCrossingCount*2)/3; // reduce value so it typicially stays below 256 zeroCrossingCount = newZeroCrossingCount; // update only once, to avoid that effects pick up an intermediate value // release highest sample to volume reactive effects early - not strictly necessary here - could also be done at the end of the function