I´m trying to control a neopixel ring so that it reacts to music.
My current setup looks like this:
For the controllor I´m using a NodeMCU ESP8266, the music gets analyzed by a breakout board with a MSGEQ7 chip, which filters the incoming frequencies with 7 filters from low frequency to high, and puts out a value from 0-1024 based on the current strength for each frequency band.
The code that I wrote up to this point takes every band and checks if the current reading exceeds a set threshold, if that is the case a set of pixels on the ring lights up in a color of my choice and starts to fade back to black if the next reading is below the threshold. This kinda works and looks surprisingly nice, but only at a certain volume. When the volume is increased, the readings of each band increase with it, so at some point all leds are just constantly fully light, because the readings are then always above the threshold.
My current plan is to design a function that dynamicly adjusts the threshold according to the strength (value) of each band, so that the threshold gets heightened when the volume increases, and lowers when it decreases. Right now I have to manually find the right volume on each device (PC, Smartphone etc.) I tried it with manually, but I want it to be independent of the device and set itself according to the current audio level right away.
Can someone help me find a solution for this or has dealt with something like this too?
I would be very glad if you could help me.