Closed ArduinoNerdBheeshma closed 2 years ago
Update- Line in works but with bass only. Leds react only when bass is played. Also I misspelled depth it's intensity
Some questions:
You might want to check the quality of your power, because a squelch (and not squinch) of 19 should cut out a considerable amount of background noise. The microphones do not work below 60Hz.
Please note that there is a considerable amount of interference from the WiFi on the ADC. See Noise Article and that a better bet is to use an I2S microphone such as the INMP441 or ICS-43434. The noise issues are documented in our SR Wiki.
As for reacting to music that's faint, you would use Automatic Gain Control, however that's a tricky beast, because the device will no longer differentiate between quiet passages in a song and louder ones. Everything will look loud.
I recommend that you use a test sketch such as this sample sketch to ensure you don't have issues.
Please compare your results to Noise and Spikes article.
Hello ,
I think I have seen you asking this question in wled discord or forum , please drop by the soundreactve channel as I have already replicated your setup with max4466 , 512 pixel ws2812b matrix and line-in on multiple MCUs with very good results and no noticeable ambient noise or interference issues .
As this seems to be a user setup/hw related , I think having a github bug report for WLED it is not accurate , kindly close the same .
If you drop by wled discord or forum and would like me to directly assist in isolating your issue then I am available with the name ALDIY .
Cheers , AL
Hi,
I have a similar setup with analogue MAX4466 microphone and ESP32 board (a "Lolin32 lite"). The mic itself seems to be very good, sensitive even with sound sources several meters away (clapping of hands, trampling feet, ..).
Squinch:19 gain:5 ADC:34 Taped to my TV's speaker
In contrast, the following works for me:
. However I found that there are several other hardware/wiring aspects that might introduce noise:
-> 1. use an input that is not related to "ADC2", i.e. the second ADC converter of the chip. This is used for Wifi, and the ports connected to it will not deliver meaningful values. --> Don't use these GPIOs: 00, 02, 04, 12, 13, 14, 15, 25, 26, 27
-> 2. stabilise the 3.3V power line. Its the ADC reference, so any noise (due to variations in power draw) affects analogue readings. --> For my board, I've seen great improvements after connecting a 1000µF capacitor between 3.3v and GND.. If you have, try to use a "low ESR" capacitor for this.
hope this helps :-)
Apart from that, there seem to be some sources of "artificial spikes" in the code for reading the MIC input and performing FFT. I managed to eliminated some of them in my own copy of the code, however it still needs a lot of cleanup before I can make a PR.
Some problems I found, especially for the FFT analysis:
FFT.DCRemoval()
that does a much better job.abs()
. It looks innocent, however when applied to a signal that also has negative values, it flips your signal over to the positive half whenever there is a zero crossing --> adds noise to the FFT.i2s_adc_disable()
/ i2s_adc_enable()
seems to add pop/crack sounds when using an analogue MIC. The reason might be that the ESP32 i2S driver is not aware of the DC offset (Vcc/2) in the MIC input. After i2s_adc_disable()
the input is set to 0, however when switching it back on, the reading jumps back to the DC offset of Vcc/2 -> effectively a DIRAC impulse that burns itself through all frequency bins in an FFT.I'm trying to make a PR with my proposal on how the code might be improved. However it may take some time...
Sounds like some real good additions/fixes. You might also want to talk to Haribo on the WLED Discord. He's been involved with the sound stuff as well.
Thanks, will try to chat with him 👍 once I have cleaned up my patched code a bit.
Btw, I've spotted something strange in the agcAvg()
code:
https://github.com/atuline/WLED/blob/575853db3af7ef4402b3f129c1a6012a23a7ed4e/wled00/audio_reactive.h#L203
Maybe this should be if (tmpAgc > 255) tmpAgc = 255;
?
At least it looks strange to me, that the AGC multiplier is reset to zero each time that it reaches 255.
That's most likely my fault, and I'll have to try and remember what I had in mind there. I hastily added the tmpAgc variable once I realized the multi tasking nature for use with segments and that I could not have interim values of sampleAgc.
Edit: Oh, and we typically work on dev and leave Master to @THATDONFC who merges dev and upstream WLED to make our Master.
Back to the question from @ArduinoNerdBheeshma - Another problem with analogue microphones, especially MAX4466, is they are really sensitive to Vcc voltage "noise" ripples. I was able to reduce the wifi-related noise with a capacitor. However also make sure not to power the LED strip directly from the ESP32 board (neither from 3.3V nor 5V). Each time that the strip lights up, it draws power and this will add loud noise to the microphone ADC readings.
Describe the bug
Hello I'm making a diy nanoleaf with about 565 neopixels, a 5v 20a power supply, esp32 dev and a max 4466 electret mic. The esp boot cycles on power up but sometimes turns on fine. But when I turn on a music effect the leds bounce around in complete silence. Decreasing the gain on the max4466 does solve this issue but it becomes too un sensitive. Pls help To Reproduce Squinch:19 gain:5 ADC:34 Taped to my TV's speaker Depth: halfway Gain on mic board: unknown
Expected behavior The whole strip is off at silence’’ Reacts to music that is a bit faint too Reacts to bass Reacts to bass in rapid succession Maybe reacting to lyrics as well Maybe react to speech in the bg*
WLED version Esp32 dev