diff --git a/usermods/artifx/arti.h b/usermods/artifx/arti.h index 2e5fda45..21eb649f 100644 --- a/usermods/artifx/arti.h +++ b/usermods/artifx/arti.h @@ -3,7 +3,7 @@ @file arti.h @date 20220818 @author Ewoud Wijma - @Copyright (c) 2023 Ewoud Wijma + @Copyright (c) 2024 Ewoud Wijma @repo https://github.com/ewoudwijma/ARTI @remarks - #define ARDUINOJSON_DEFAULT_NESTING_LIMIT 100 //set this in ArduinoJson!!!, currently not necessary... diff --git a/usermods/artifx/arti_wled.h b/usermods/artifx/arti_wled.h index 78627a25..96e46270 100644 --- a/usermods/artifx/arti_wled.h +++ b/usermods/artifx/arti_wled.h @@ -3,7 +3,7 @@ @file arti_wled.h @date 20220818 @author Ewoud Wijma - @Copyright (c) 2023 Ewoud Wijma + @Copyright (c) 2024 Ewoud Wijma @repo https://github.com/ewoudwijma/ARTI */ diff --git a/usermods/artifx/usermod_v2_artifx.h b/usermods/artifx/usermod_v2_artifx.h index ee0899d8..1a912081 100644 --- a/usermods/artifx/usermod_v2_artifx.h +++ b/usermods/artifx/usermod_v2_artifx.h @@ -3,7 +3,7 @@ @file usermod_v2_artifx.h @date 20220818 @author Ewoud Wijma - @Copyright (c) 2023 Ewoud Wijma + @Copyright (c) 2024 Ewoud Wijma @repo https://github.com/ewoudwijma/ARTI */ diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 6c7fe132..b74cd9c7 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -141,6 +141,10 @@ static uint8_t fftResult[NUM_GEQ_CHANNELS]= {0}; // Our calculated freq. chann static float fftCalc[NUM_GEQ_CHANNELS] = {0.0f}; // Try and normalize fftBin values to a max of 4096, so that 4096/16 = 256. (also used by dynamics limiter) static float fftAvg[NUM_GEQ_CHANNELS] = {0.0f}; // Calculated frequency channel results, with smoothing (used if dynamics limiter is ON) +int zcr = 0; +int energy = 0; +int lfc = 0; + // TODO: probably best not used by receive nodes static float agcSensitivity = 128; // AGC sensitivity estimation, based on agc gain (multAgc). calculated by getSensitivity(). range 0..255 @@ -551,7 +555,18 @@ void FFTcode(void * parameter) // pick our our current mic sample - we take the max value from all samples that go into FFT if ((vReal[i] <= (INT16_MAX - 1024)) && (vReal[i] >= (INT16_MIN + 1024))) //skip extreme values - normally these are artefacts if (fabsf((float)vReal[i]) > maxSample) maxSample = fabsf((float)vReal[i]); + + // WLED-MM/TroyHacks: Calculate zero crossings + if (i < samplesFFT-2) { + if (vReal[i] * vReal[i+1] < 0) { + zcr++; + } + } + // WLED-MM/TroyHacks: Calculate energy + energy += vReal[i] * vReal[i]; } + energy /= 100000; // WLED-MM/TroyHacks: scale this down becasue we're gonna make it bigger later + // release highest sample to volume reactive effects early - not strictly necessary here - could also be done at the end of the function // early release allows the filters (getSample() and agcAvg()) to work with fresh values - we will have matching gain and noise gate values when we want to process the FFT results. micDataReal = maxSample; @@ -646,6 +661,8 @@ void FFTcode(void * parameter) vReal[i] = t / 16.0f; // Reduce magnitude. Want end result to be scaled linear and ~4096 max. } // for() + lfc = fftAddAvg(1,9); // WLED-MM/TroyHacks: Calculate Low-Frequency Content + // mapping of FFT result bins to frequency channels //if (fabsf(sampleAvg) > 0.25f) { // noise gate open if (fabsf(volumeSmth) > 0.25f) { // noise gate open @@ -1746,6 +1763,10 @@ class AudioReactive : public Usermod { um_data->u_type[9] = UMT_FLOAT; um_data->u_data[10] = &agcSensitivity; // used (New) um_data->u_type[10] = UMT_FLOAT; + int extra[3] = {zcr, energy, lfc}; + um_data->u_data[11] = extra; // + um_data->u_type[11] = UMT_INT16_ARR; + #else // ESP8266 // See https://github.com/MoonModules/WLED/pull/60#issuecomment-1666972133 for explanation of these alternative sources of data diff --git a/wled00/data/settings_sec.htm b/wled00/data/settings_sec.htm index 9f164a3f..16923ea1 100644 --- a/wled00/data/settings_sec.htm +++ b/wled00/data/settings_sec.htm @@ -116,12 +116,12 @@

About

WLEDMM version ##VERSION##
- (c) 2023 Github MoonModules WLED Commit Authors

+ (c) 2024 Github MoonModules WLED Commit Authors

fork of WLED:
Contributors, dependencies and special thanks
A huge thank you to everyone who helped me create WLED!

- WLED core (c) 2016-2023 Christian Schwinne
- Licensed under the MIT license

+ WLED core (c) 2016-2024 Christian Schwinne
+ WLED MM Licensed under the GPL v3 license

Server message: Response error!