From a1bdb47c30234b4e25dde930ee20373925624e35 Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 10 Apr 2023 23:57:44 +0200 Subject: [PATCH] trying to make sound pressure less boring for line-in "sound pressure" for line-in was always close to max - which is expected, because the ADC chip utilize the full 24/16bit sample range. The new calculation leads to some more "movement". --- usermods/audioreactive/audio_reactive.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index e5536ce4..05305671 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -1269,8 +1269,12 @@ class AudioReactive : public Usermod { float micSampleMax = fabsf(sampleReal); // from getSample() - nice results, however a bit distorted by MicLev processing //float micSampleMax = fabsf(micDataReal); // from FFTCode() - better source, but more flickering if (dmType == 0) micSampleMax *= 2.0f; // correction for ADC analog - if (dmType == 4) micSampleMax *= 16.0f; // correction for I2S Line-In + //if (dmType == 4) micSampleMax *= 16.0f; // correction for I2S Line-In if (dmType == 5) micSampleMax *= 2.0f; // correction for PDM + if (dmType == 4) { // I2S Line-In. This is a dirty trick to make sound pressure look interesting for line-in (which doesn't have "sound pressure" as its not a microphone) + micSampleMax /= 11.0f; // reduce to max 128 + micSampleMax *= micSampleMax; // blow up --> max 16000 + } // make sure we are in expected ranges if(micSampleMax <= sampleMin) return 0.0f; if(micSampleMax >= sampleMax) return 255.0f;