Hey Scott. Keep up the good work man. I'm sorry to see how disgracefully G6EJD handled the whole copyright thing. Rip out his code and switch to audio_reactive.h from WLED (MIT licence) and remove all his credit. It's the least the guy deserves.
Thank you, that's the plan. As soon as I'm able I will remove any references to his code and links to his channel. Andrew from sound reactive WLED also messaged me in suppport and I really appreciate it from both of you.
You could just grab an older version of his library which is licensed under the mit license. You can't retroactively apply a license change... That would be a social nightmare!
Only just reading your spat with G6EJD and don't see what his problem was. You gave credit albeit in an "unofficial" form. The irony is that on his YT channel he writes "A collection of predominantly technical videos with an aim of helping others to understand topics, to share knowledge and to give examples of what can be achieved." Keep up the good work Scott. You did nothing to deserve that kind of response.
Thanks for the video Scott. It told me just what I wanted to know. This post is for the benefit of anyone considering using an ESP32-S3. Its A/D is not as fast as the ESP32. I ran the Sample Test sketch on a LilyGO T-Display-S3 and got the following rates So I guess its good to around 8kHz audio which is the upper limit of what I need. Conversion time: 60.12 uS Max sampling frequency: 16633.61 Hz Conversion time: 60.12 uS Max sampling frequency: 16632.99 Hz I then thought I could be clever and reduced the A/D resolution from 12 to 9 bits to get a higher conversion speed but alas no luck in Arduino IDE. It was identical.
Hey Scott, thanks for this fantastic starting point for my project. I made this powered by a DeWalt battery, mounted to a pole and had to heavily modify the code and hardware to get it to work in any volume level environment. I can't say how much longer this would have taken without this starting point, but I can say it would have been a lot longer. I had the idea to do it 8 years ago and finally sat down to do it last January and found your project during the research phase. Finished it in August and took it to a music festival, people absolutely loved it. Thanks again for the great work!
Hi, I was about to make a 7-band audio spectrum visualizer with an Arduino Nano and a MSEQG7 chip, but searching UA-cam I found this project, easier, more powerful and more impressive. Thank you.
@Scott Marley thanks for sharing, have to say it, this is so far the best video tutorial on how to use the arduinoFFT library I have seen. Keep it up. Great Job!
Thanks for a wonderful tutorial. My build went right to work 1st time and the different modes were a delightful surprise. My larger project is to use an IR distance sensor to track trombone slide movements and encode MIDI signals. Besides recording parallel audio and MIDI signals, I can also light 64 individual WS2801 led's in a spiral piano array. Additionally, the MIDI signal operates a silent mono synth that in turn runs your spectrum analyzer. Part an art piece and part a scientific search for patterns in microtonal music. Thanks for adding another dimension to my quest. GCH
Thank you so much for this project. I manages to recreate it using an 8*32 led SPI matrix and a teensy 4.0. This is an amazingly well made and explained project which I had a lot of fun with. Keep up the good work and wish you the very best :)
Turns out you can also have the ADC sample for you at a provided sample rate, and have it do DMA into buffers which you can then use I2S to read (and avoid spending the CPU time doing the sampling). I’ve been using this on my led strip audio visualizer that I’ve been working on, and it seems to be working great so far.
@@ScottMarley looks like youtube deleted my last comment that had links in it, so I'll instead give you a YT video ID of an I2S tutorial for the ESP32: ejyt-kWmys8 Also, check out the "HiFreq_ADC" example in the I2S folder of the esp32-arduino github for how to configure the internal ADC to give you data with I2S. I increased the buffer size and count from the values in that example to avoid wasting time repeatedly calling i2s_read for only a few samples each time.
Hey Scott. I know this is a massive shot in the dark but I've been having issues recreating your project because my ESP32 can apparently only read the analog pin at 14kHz. Could you share the exact board you are using or if maybe your ArduinoIDE setup is different if possible? Kinda scared to get into possible solutions like I2c. Great video by the way, got me into making stuff at home and not waiting for school projects to start being interesting.
Love this! That is such a beautiful, clean and crisp Matrix that you've put together and looks fantastic with that spectrum analyser running on it. Well done! 👍
Hello. i just bought an ESP32 module, when i try to run your test i got: 14:50:59.321 -> Conversion time: 53.85 uS 14:50:59.321 -> Max sampling frequency: 18570.64 Hz so under 20KHz... that shouldn't be that low right?
They seem to vary a lot. Not sure why as I'm not an expert on these things! You could build it anyway, it will still look pretty just won't be as accurate. The microphone won't pickuo up to 20kHz anyway
Hey Stefano, I had the same experience with every ESP32 I tried (I think 3 or 4 different in total) being much, much slower than what I saw in videos I watched. Try running yours with a sampling frequency of 30,000 Hz and 256 Sample Size. From what I tried with mine that seemed to provide decent performance. 40 KHz and 1024 Samples always produces a slideshow for me.
From other replies, change the version of your esp32 firmware in the arduino IDE boards manager to 1.0.4 as 1.0.5 and 1.0.6 return the slower sampling rates you are experiencing.
How are you getting your ESP to sample that fast? Tested mine and the most I could get it up to is 11.36kHz. I read up about using the I2S peripheral and DMA but there's no mention of that here, and yet you can still get it up to >100kHz. Maybe it's the specific board you have?
I just had a try on my esp32 with "Sample_test.ino" and I received very poor conversion time 84.96µS with a max sampling of 11000Hz, reading the comment I found that installing ESP32 1.0.4 version should solve this issue and this is the case I get now 9.23µS and 108332 Hz. I don't know the reason , surely related to clock divider but I can continue now with this amazing project. Thanks a lot.
As per one of the comments and responses below, in the boards manager of arduino IDE uninstall the esp32 board version you are currently having and install the 1.0.4 version. I was having the same issue and this fixed the issue for me! Maybe Espressif have to pay attention for this when they release the 1.0.7 update!
Yo you nailed it with this one I am going to try something Similar based on your code and I am super thankful for the code you provide! I was thinking about something like this for many years, even more so since studying fft and your video and the fft library are a big motivation to get going!
hello, I couldn't find instructions for turning the leds vertically and horizontally in the arduino code, can you help? Since I connected the leds vertically, a horizontal image was formed. how can i rotate
I just find: #include "esp32-hal-cpu.h" and in the setup: setCpuFrequencyMhz(240); and to read: Serial.print("CPU Frequency is: "); Serial.print(getCpuFrequencyMhz()); //Get CPU clock Serial.print(" Mhz"); Serial.println();
Hello everyone. i got a question and hopefully someone can help me :) i wired up my ESP32 (Dev KitC V2 ESP32-WROOM-32) Line in version as you can see @10:48 and dont know what i got to set in the WLED app to make it respond to the sound
Hello, I would like some help with the following: I have a 7018b touch screen on which I made a boom box and I want to connect the audio output directly to the Arduino uno that will connect the lieds board 8x32 led RGB panel to the rhythm of the music without using the Sound Sensor. Where can I find the schematic and code? I used sp107e box and it doesn't work properly because the leds go up and down even without music.
Hello, excellent video very informative and easy to follow. I have been wanting to build a software spectrum analyser for a while, there is a place that you have shared your FFT calculator?
I'm doing something extremely similar and your video has been an extremely helpful resource, I've added a few things like an amplitude balancer. I am running into one issue that I don't see how you overcame. My analog read function takes 49 microseconds, not 9.7 as documented in code or 10 as mentioned elsewhere. The whole loop takes 52 microseconds and that's a little long for wanting 25 microseconds. I'm struggling trying to find a solution. If you or anyone else knows of one or some hints, That'd be awesome
This might be not be the issue, but have you tried different pins? I think another commenter mentioned that they had a similar issue and using a different pin as input made it faster. I might be wrong though! The other thing to check is the clock speed. Is it set to 240MHz? Other than that I'm not sure, I'm not an expert on this stuff I just document what I make.
Hello. I am making a system similar to this but I need to invert the matrix horizontally and vertically. What path can I follow? my matrix horizontal 6 vertical 20
So I bought my first esp32 for this project. Tested the sampling rate and the highest I can get is is ~12khz. Is there anything I can adjust or do I need to get a different board?
Thank you it was helpfull, but i had a question, can I use different band out put in to different GPio pin or output pins? by doing some adjustments on the code?
Great video. I have just put together a matrix using a string of WS2815 leds, rearnaged into 10 * strips of 16. I've yet to put together the code, so I'll find this very helpful, as I had intended to do something almost identical to your output. I enjoyed your explanation of the FFT, very scuccint. :)
Hi Scott, I saw your 3D printed spectrum analyzer (amazing project) that uses a INMP441 digital mic and I’m trying to adapt that code to this first version, because I prefer a physical control rather than depending on a smartphone, but my experience with C is limited, and I’m not able to find the exact part that manages the audio input. Could you please help me? TIA.
I know this is a really old video, but would you mind posting your spreadsheet, or the maths that go into it? I'm having a little trouble recreating it, and it would be a MASSIVE help for writing a more generic binning function. Thanks!
Hello. I need your help with something. I enter the 5V supply from the adapter to the matrix panel, it is also connected to the 5v input of the microprocessor. it's already a simple circuit, after all, there is nothing but a panel and a microphone. When I energize everything works great. After a while, random LEDs start to light up in the animation. Then smoke comes out of the ESP32. what am i missing? Is the panel somehow drawing current from the microprocessor? What should I do to prevent this?
My nodemcu esp32 board only manages 18khz, which is very confusing ... Shouldnt those boards all be the same open source hardware? I reduced the sampling freq to 18khz for now, but results should be worse, i fear. Could you link boards that worked out well for you? i also came across the problem, that my sensitivity usually is way off. any ideas on how to automatically adjust it?
Hi scot, can you please help me to make your code to run on Nextion Display.... each band data will map to run progress bar property ... eight or 16 progress bar in vertical position of Nextion display. Thank you.
Hello Scott Marley, I have a problem regarding the Max sampling frequency of my ESP32's, running the test shows that the conversion time is 53 µs and therefore the max freq. is only 18kHz which translates to 9kHz Audio. My ESP's are way slower than yours, do you have a clue?
Hi Yiruma. As mentioned below by Marek Bohumsky If you install the 1.0.4 version of the ESP32 board via the Boards manager and re-run the sample code it does give a result of 9.73uS. I had the same issue and changed the code for the lower sample rate. Now that I have also found the answer (from below) I will try it with the corrected code. Just passing it on, hope this helps.
! Thank you so much for the clear description of FFT as well as the library. I'd like to ask if it's possible to read the data from Bluetooth? I mean using the A2DP library to feed audio signal instead of line in. I've seen other people do this but none comes with an explanation of their code. Thanks in advance!
Hello, thanks for the amazing video. I already had a DOIT ESP32 unit so i decided do make this. I am already quite far. I only have one issue and that is that my ESP32 has a conversion time of 52.17 uS, so a max sampling freq of 19166.64 Hz . I am still reading into the documentation in order to improve this. Do you have any leads?
Someone responded to similar problem down below: "If you install the 1.0.4 version of the ESP32 board via the Boards manager and re-run the sample code it does give a result of 9.73uS."
Good job. Is it possible to change the code to use a led strip ws2812b instead of the matrix? I would like to cut the led strip in 8 parts with 30 led and create 8 channels, the first being starting at led 0 to 30 for "center bin 2", from led 31 to 60 for "center bin 4", led 61 to 90 for "center bin 9" ..... It's possible? sorry for my English.
Yes, that will work fine. Just wire the strips up from one to the next and edit the xy code for however yours is wired up. Mine is simply 16 strips of 16 LEDs wired from one to the next. You will need to understand how the xy code works to make the changes yourself.
I tried writing fft on my own.But It is not efficient enough.complex calculations makes the problem lot harder.Is there an efficient way to implement complex numbers.I used a 2d matrix (2 columns) to do my claculations and I think it makes the program lot slower.And is a buffer with 1024 samples enough to implement ?
The Arduino fft functions have been written to be very efficient, using special techniques to save CPU cycles and RAM. Is there any reason why you want to write your own version? It's not trivial, and you would have to have a good knowledge of both mathematics and C++
@@SLguitarGuy for fun is a good reason! There is info on the Arduino library implementation here wiki.openmusiclabs.com/wiki/ArduinoFFT and it details some of the optimisations that have been made.
Are you selling this? if yes can you pls say the details of this vu meter, And where are you staying now, I’m from India,Kerala. I’m interested to buy this vu meter
@@ScottMarley I had a play around with it this evening and I couldn't get it working properly. Does the audio source need to be amplified? Like would a cable from a phone headphone jack to the esp32 be what's expected? I wasn't displaying on anything really, I was just printing the value for the top of the line in serial monitor. If I tapped at the line in cable I could see some values, but never anything when playing music. Any suggestions? (Btw I was using a board that doesn't have pin 35 or whatever pin you were using , so I tried 32 and 33, both were the same, I update the pin in the code each time too)
No amplification was required for me, works straight from the headphone output of a phone. What values are you printing out, barHeight? And for each channel? Are you using the circuit for line in given on the GitHub page?You can also play with the AMPLITUDE parameter, lower values make it more sensitive (I think, can't quite remember now!). The input pin shouldn't matter, I'm not doing anything clever here ;)
Hey Scott! I really like your Project and I'm trying to build a simliar one. I'm using an ESP-WROOM-32, but my max datarate is 10 times lower than yours. Do you have any idea why this might happen?
Hello sir please help How to add (EEPROM memory) for last pattern save option to the software. I don't know anything about coding it possible kindly help me please
Hi Scott. Thanks for amazing video man. FFT on ESP32 wonderous. A quick question. I tried hooking up line in with a 3.5 audio socket, 2 10k res for mono, 100nf for DC filtering and 2 100k for DC biasing. But when I connect my iPod or phone output to this, I get no audio read in pin 35. I tried changing to 34 and 36 too. But there is nothing there. Do I need to use an analog amplifier when using with PC/Mobile/iPod headphone out? Thanks for the wonderful explanation about FFT and your code!
Skecth ran slowly, but now it flies... I had previously commented that, despite following along exactly and trying different board library versions, as suggested in comments, my esp32 ran like a 3 legged dog with asthma, uphill, with a heavy back pack on! However I spotted something (or was that, I missed something) and that was the pin being used in the sketch, pin 35... When I checked my datasheet, this was not listed on my esp32 as an audio pin so I simply changed it to a pin that was and bingo... The sketch now runs sub 9uS. :-) Now whether or not that should have made a difference could be one for debate, but it did solve my problem.
Hi, I'm hoping you can help me. I have just started with Arduino and have been trying to make a spectrum analyzer using various codes for projects like these downloaded and run in my IDE. I have the latest "arduinoFFT" library 2.0.2 by Enrique Condes but every project I try returns the fault: error: 'arduinoFFT' does not name a type; did you mean 'ArduinoFFT'? arduinoFFT FFT = arduinoFFT(); I can see the difference between "arduinoFFT" and "ArduinoFFT" but the code obviously works for others so why do I get a fault for each project?
...the reason I ask is it works yet I get several cycles of good data in the bands then it goes haywire fir a few cycles and then the good data comes back. This is constant. Is there some sort of interrupt in the code could be taking place or could it be timing? Any thoughts of what it could be? I am very new to this but I am a quick learner.
That looks very very cool ..huge thanks for the hard work compiling this tutorial...and an excellent explanation of the sampling mechanism....i have tried fft with 8266 devices but when the WiFi is active it seems to make the ADC input 'noisy' ...have you tried this with WiFi running on the esp32 ..I'm now going to order a few Esp32 board's....on a side note have you seen any of Andrew Tuline's fft stuff ?? he's been doing sound reactive fft projects for a few years and has made some quite artistic lighting projects.
Thanks for your comments, it really was a few days work putting that together even though it might not seem like it! I don't have an 8266, but I know on the ESP32 there are two ADCs, and ADC2 is somehow used for the WiFi. So as the 8266 only has 1 ADC, maybe this has to be shared between the analog pin and the WiFi causing interference? Just guessing here though. Andrew is the chap who does the WLED sound reactive port right? I haven't looked at it yet as I wanted to figure out how to do things myself in the first instance, but I do have an idea for a project that WLED would be good for. Stay tuned!
@@ScottMarley ah so that would explain why the esp32 works where the 8266 doesn't ..well i say doesn't I have had it working with an ADS1115 I2C ADC module but you have to jump through hoops to get the sample rate high enough ...you're version is much easier ....here's hoping you're channel grows...anyway bought some ESP32's .
Hi, Sorry but I regret to say that the code cannot be compiled in Arduino: displays error: “/home/macieju/Desktop/Arduino_ESP32_FFT/Arduino_ESP32_FFT.ino:136:3: error: 'FFT' was not declared in this scope FFT.dcRemoval(); Compilation error: invalid use of template-name 'ArduinoFFT' without an argument list”
Can you also use a MAX9814? I'm thinking the auto gain could be nice for adapting to volume? I'm making a similar project, it'll actually be a sound reactive infinity cube inspired by one of your other videos. Hopefully it turns out.
Yeah, I dont see why not. I think I've used that before for something. These days I tend to just use digital mics like the INMP441. Much more complicated to set up, bit much better audio quality.
If you would leave out the capacitor on the audio in, wouldn't the ADC just ignore the negative values? That way you'd get double sensitivity on the input and you wouldn't have to discard the negative samples.
You don't want to stress the ADC with negative values, it probably won't hurt it at such low voltages but it's not designed for it. You wouldn't increase, the sensitivity by doing this anyway, in fact you would be losing half the information in your signal. When you say discarding the negative samples, are you talking about discarding half the vReal array? You would still have to do this. Once the FFT has been performed, the vReal array no longer contains the audio samples themselves, but the FFT results. These are two completely different things, and we are just reusing the vReal array for convenience. At first each element in vReal represents a 25uS slice of time, containing the audio level. After the FFT each element in vReal is a frequency bin containing the amplitude of that frequency.
Just to add (as I went off on a tangent there!) The DC blocking cap is there to block the 1.65V from going back into your audio source (phone or whatever). It's not a good idea to inject DC into the output of an audio device like that :)
Thanks for pointing that out! This was broken by a pull request that I merged, and don't spot this issue at the time. Should be fixed now, although I haven't tested the code. Cheers.
Hi Scott, your project is very cool. I am currently doing a school project with STM32F103 MINI V3 development board to make a Music LED Spectrum Analyser like yours. May I know which module would you use in the line-in setup for receiving an audio signal from a computer or phone?
Did you test out with microphone setup? How much worse it is compared to line input? looking to get 20-20KHz electret microphone with amp and gain control to make thing easier.
No, too busy to go back an look unfortunately. I did make a whole new VU type thing using a digital INMP441 which you can find on my channel. It's a cool little gadget, but needs some tuning to make it a bit more accurate. Having used the digital mic, I definitely won't be going back to the old analogue ones now though, it's so much less noisy!
Hey @Scott Marley , I know this is quite an old video, but I did have one quick question regarding one of the animations if you were still around? I have more or less completed this project (Awesome video, major thanks for making this), however, all of the light patterns work correctly apart from the purple and blue gradient one named "purpleBars" in the code. the bars function correctly, however, the purple part is placed randomly among the blue bars rather than at the top as an even gradient as you demonstrated, and seems to be glitch around as the bars shift. Any idea what might be causing this? Thank you for your time!
Hi Scott, Yet another excellent video. Ive been attempting to use an MSGEQ7 to position a servo based on speech (anamatronic project) ; after looking at your work your ESP32 VU meter project, it would appear it might be a viable alternative to use ArduinoFFT. Im definitely in the 'novice' category when it comes to coding so would be grateful for some assistance. As Im only looking at male/female vocal frequencies, I don't require many bands. I also need to average these and map against the range of a servo. How easy is this to achieve?
You need to complete everything in the green box on the Excel sheet and everything else is populated automatically. To see how I calculated these, look at the equations in the Excel sheet.
Greetings. First, thanks for the video and for the device and the code for it! Thanks for the hard work! I repeated the device, but several questions appeared, with which I ask you to help. I do not understand well in such crafts so far .. 1) Your vu meter speed is faster than mine. I have a feeling that it slows down, it does not work so smoothly. Is there something wrong with the firmware? (although it may seem to me ..) 2) Everything works only when the ESP32 is connected to the computer via a usb wire. If you power it separately from the power supply, the entire image on the matrix hangs and does not react in any way to the sound / button. What could be the problem?
I love the esp32 but when I run the code, even though I have nothing attached to the ESP32, the middle bands are still being populated with data. Do you know what is going on?
Great tutorial. I do not have this led breakout but I will try to adapt your code to work on an optimized and very fast oled library I wrote for SSD1331 and SSD1351 color oleds (96x64) and (128x128). I have a question for you... what ESP32 Arduino Core version do you used to make this ? I tried your code to get max sampling rate from ADC but using last 2.0.6 core I get about 11Khz max and a sampling time about 90us on Wemos D32. Instead using ADC over I2S DMA the max sampling rate from core examples sketch is 277 Khz. Probably something was changed in the core. Anyway, the library I wrote is hardware optimized and permits very high refresh rate, I can stream videos from microsd up 140 FPS with both ESP8266 and ESP32 so I think results shoud be good and fast. For ESP32 I just used single core, so probably It can be optimized more. But note that SSD1331 have a very small display, about 2.5x2 cm. Before to do it, I have to use FFT arduino library for a bit different project, I need to acquire audio from I2S microphone use FFT to get a frequency and convert it to midi. I have no problems for midi and others stuff but my problem is FFT library, I never used it. I found a couple of tutorials on how make a spectrum analyzer, but I do not need to get all bands to show, instead i need to just know an most precise possible the dominant frequency that is at higher level, the fundamental of a voice or whistle over a microphone. You think Great tutorial. I do not have this led beakout but I will try to convert your code to be working on an 96x64 optimized and very fast library I wrote for SSD1331 and SSD1351 color oled. This library is hardware optimized and permits very high refresh rate, I can stream videos from microsd up 140 FPS with both ESP8266 and ESP32. For last I just used single core, so probably It can be optimized more. Before to do it, I have to use FFT arduino library for a bit different project, I need to acquire audio from I2S microphone use FFT to get a frequency and convert it to midi. Please is that possible? I have no problem for midi and others stuff bu my problem is FFT library I never used it. I found a couple of tutorials on how make a spectrum analyzer, but I do not need to get all bands to show, instead i need to just know as most precise possible the dominant frequency that is at higher level, eg. the fundamental of a voice or whistle over a microphone. Please do you know is that is possible ? Should be realtime... Many thanks
" It can have any number of bands" Does the ESP32 have the muscle to support 31 bands? Not that it's needed (I have a 128 band RTA) but the eye-candy would be fantastic.
Hello. Thank you for yet another fantastic video. I've used the suggested code to check the sampling rate of my ESP32 and I'm getting nowhere near what you are. Mine comes out closer to 11 kHz! I don't think I've made a typo in the code... I'm using pin 33 of my uPesy ESP32 Wroom DevKit board. Is there a faster pin, or is this a slow board? Any help would be much appreciated!
Amazing video sir! I just completed the entire circuit and it seems like it's reacting to music accurately, however my bars keep pulsing from right to left. I connected the input to matrix to bottom left, so my question is how can I turn it 90 degrees so it can pulse from bottom to top? Is it located here: // XY code for serpentine matrix with input in top left uint16_t XY( uint8_t x, uint8_t y) { uint16_t i;
y = kMatrixHeight - 1 - y; // Adjust y coordinate so (0,0) is bottom left if(SERPENTINE) { if( y & 0x01) { // Odd rows run backwards uint8_t reverseX = (kMatrixWidth - 1) - x; i = (y * kMatrixWidth) + reverseX; } else { // Even rows run forwards i = (y * kMatrixWidth) + x; } } else { i = (y * kMatrixWidth) + x; } return i; } . If so what parameters do I have to change so it does what I want it to do? (BTW I wired my matrix in PROGRESSIVE configuration/all led strips are facing the same direction). Thank you in advance, I'm looking forward to the next project.
@@marcosanti2357 OMG that actually worked!!! Thx a bunch dude. I had to play around with the code a bit, but regardless it works perfectly. Here's how this section of the code looks now: // XY code for serpentine matrix with input in top left uint16_t XY( uint8_t x, uint8_t y) {
Hi Scott, i built my own version with 24 bands, sadly some of the frequency bands on the top part are always maxed out... any ideas what could cause that? (Seems to be affected by the brightness of the matrix, so maybe something corelating with the max amps flowing?) Thanks for the awesome walkthrough video, had alot of fun with this project!
I have also faced that and here are some of the reasons/solutions - 1. Top bands sum up many frequency bins - so small errors get summed up. Reducing the upper range of max band (264-380 instead of 264-512) helped. Adding a per-band noise level helped (500 for lower band, 1500 for highest band). 2. Changed the amplitude sum to bar height mapping - made it logarithmic scale and used some y = a + bx + cx**2 formula. For ex. when your Tv/computer is at 50% volume, the amplitude is not half of max amplitude, it's probably around 1/4th.
Nice work! Did you take the line from the amplified signal, in parallel with the loudspeakers? No impedance change in the loudspeakers nor spurious interferences to the signal, giving distortions?
No, it takes a line-in. Be careful if you use the speaker cable. The maximum input voltage on an ESP is 3.3V, speakers are driven far higher than that usually so you would need a voltage divider etc.
@@luigimorelli6444 make sure you look at the circuit diagram on GitHub. It is very low level, but that's ok. I actually find it works best using a microphone instead.
Really great and helpful:) But I was wondering if you could tell me how you calculated the frequency multiplier and the center bin, because I can't find any information about that in the video and I'm new to FFT so this really would be helpful. Thank you:)
It's a bit difficult to explain in a comment here. Have a look at the Excel sheet on GitHub, and all the equations are in the appropriate cells. You can work backwards from whatever you're trying to figure out!
so i've tried this and it works so far. I also tried to split the line in so that I can plug in my headphone but then it stopped working for some reasons. Could it be the voltage drop after splitting?
This seems to work with some inputs and not others. I believe it is to do with the impedence of the things that are plugged into it, causing a voltage drop as you say. The 'proper' way to do this would be to use an opamp as a buffer between the connected devices (as they have very high input impedance), but was a bit complicated to show in this video.
Adding on to this, if I slap a buffer/voltage follower with an ne5532 right before the esp32 input pin, that should work a treat for this problem right?
Scott this product is amazing and your vu meter fft calculator looks better then any I seen online. Do you have a video on how u set up your Vu meter calculator on excel or file for calculator? I'm a beginner and your explanations are easy to follow even with no experience.
Arduino: 1.8.19 (Windows 10), TD: 1.57, Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None" Marley_spectrum_analyser:46:28: fatal error: audio_reactive.h: No such file or directory compilation terminated. exit status 1 audio_reactive.h: No such file or directory This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. This is the message I get, the library is not listed in my library, please help !
this is an amazing project and has inspired me to make a large 50x19 led matrix using this code. i cant seem to find the excel spread sheet you used to map out your bands to finish the code. did you make it your self or did you find it online somewhere? I don't think guessing would provide a good look for my bands. keep up the great work!
Hello Scott, I used your code and made a spectrum analyzer and edited your code a little, which of course turned out to be very beautiful. I made this device in 24 bands and 18 pixels high. But the audio analysis speed is a little lower than your device... Is there a way to increase the speed? In addition, I tried a lot to create a peak pause, but unfortunately I haven't succeeded yet... Do you have a way to solve these issues? Thank you very much.. by the way I am new to coding!
Great video... I'm still just getting my feet wet with Arduino IDE and ESP32 programming. I've made a few matrices but I have one in mind specifically for use as a spectrum analyzer/VU meter which would be integrated into another project, but if I follow along with this code and tutorial I believe my display will be skewed 90 degrees from how I'd like it to display. It would be a 12x12 matrix in terms of pixels, but the horizontal and vertical spacing wouldn't be equal (overall dimensions approx 10"x32". Specifically it'd be 12 strips of 12 60/m WS2812b's (so about 7" in length) spaced about 2.5" apart, and I'd want to view it horizontally. I believe if I wired it as you have, it would produce 12 3' tall bands vertically. Do you know if there Is there a way to modify the code to essentially shift what is being displayed 90°?
The code is written using the neomatrix library making it possible to use on any wiring direction and in any orientation. See learn.adafruit.com/adafruit-neopixel-uberguide/neomatrix-library for how to set it up.
This one was made with LED strip. See here for more info ua-cam.com/video/_0a9JZLGu4M/v-deo.html, although before I made this video (the vu meter) I rewired it so that data went in a zig zag rather than always in one direction
Hey Scott. Keep up the good work man. I'm sorry to see how disgracefully G6EJD handled the whole copyright thing. Rip out his code and switch to audio_reactive.h from WLED (MIT licence) and remove all his credit. It's the least the guy deserves.
Thank you, that's the plan. As soon as I'm able I will remove any references to his code and links to his channel. Andrew from sound reactive WLED also messaged me in suppport and I really appreciate it from both of you.
You could just grab an older version of his library which is licensed under the mit license. You can't retroactively apply a license change... That would be a social nightmare!
Only just reading your spat with G6EJD and don't see what his problem was. You gave credit albeit in an "unofficial" form. The irony is that on his YT channel he writes "A collection of predominantly technical videos with an aim of helping others to understand topics, to share knowledge and to give examples of what can be achieved." Keep up the good work Scott. You did nothing to deserve that kind of response.
I have never seen a complicated topic explained so intuitively and straightforward. Such an amazing video
Thanks for the video Scott. It told me just what I wanted to know.
This post is for the benefit of anyone considering using an ESP32-S3. Its A/D is not as fast as the ESP32. I ran the Sample Test sketch on a LilyGO T-Display-S3 and got the following rates
So I guess its good to around 8kHz audio which is the upper limit of what I need.
Conversion time: 60.12 uS
Max sampling frequency: 16633.61 Hz
Conversion time: 60.12 uS
Max sampling frequency: 16632.99 Hz
I then thought I could be clever and reduced the A/D resolution from 12 to 9 bits to get a higher conversion speed but alas no luck in Arduino IDE. It was identical.
Hey Scott, thanks for this fantastic starting point for my project. I made this powered by a DeWalt battery, mounted to a pole and had to heavily modify the code and hardware to get it to work in any volume level environment. I can't say how much longer this would have taken without this starting point, but I can say it would have been a lot longer.
I had the idea to do it 8 years ago and finally sat down to do it last January and found your project during the research phase. Finished it in August and took it to a music festival, people absolutely loved it.
Thanks again for the great work!
Hi. I built it! First I tried using my esp8266, but the latency was massive. Esp32 works amazing. Thank you Scott Marley for this tutorial.
This is amazing. I've seen other videos and they aren't nearly as good as this explaning the math and logic behind.
Hi, I was about to make a 7-band audio spectrum visualizer with an Arduino Nano and a MSEQG7 chip, but searching UA-cam I found this project, easier, more powerful and more impressive. Thank you.
@Scott Marley thanks for sharing, have to say it, this is so far the best video tutorial on how to use the arduinoFFT library I have seen. Keep it up. Great Job!
We need more videos of this vu meter it’s the best thing by far! Nothing else comes near!
Thanks for a wonderful tutorial. My build went right to work 1st time and the different modes were a delightful surprise. My larger project is to use an IR distance sensor to track trombone slide movements and encode MIDI signals. Besides recording parallel audio and MIDI signals, I can also light 64 individual WS2801 led's in a spiral piano array. Additionally, the MIDI signal operates a silent mono synth that in turn runs your spectrum analyzer. Part an art piece and part a scientific search for patterns in microtonal music. Thanks for adding another dimension to my quest. GCH
That's a really creative idea, I hope it all works out for you!
Hi, awesome work. I tried for so long to understand FFT and how to use it. You made it so clear. Thanks!
Thank you so much for this project. I manages to recreate it using an 8*32 led SPI matrix and a teensy 4.0. This is an amazingly well made and explained project which I had a lot of fun with. Keep up the good work and wish you the very best :)
Turns out you can also have the ADC sample for you at a provided sample rate, and have it do DMA into buffers which you can then use I2S to read (and avoid spending the CPU time doing the sampling). I’ve been using this on my led strip audio visualizer that I’ve been working on, and it seems to be working great so far.
If you have an example of how to do that, that would be great. Sounds a little over my head tbh :)
@@ScottMarley looks like youtube deleted my last comment that had links in it, so I'll instead give you a YT video ID of an I2S tutorial for the ESP32: ejyt-kWmys8
Also, check out the "HiFreq_ADC" example in the I2S folder of the esp32-arduino github for how to configure the internal ADC to give you data with I2S. I increased the buffer size and count from the values in that example to avoid wasting time repeatedly calling i2s_read for only a few samples each time.
@@yoted great, thank you!
Hey, I was wondering if you can share an example of how to do that, this would be really helpful.
I would love to see an example of this, sounds GREAT! Thank you.
Hey Scott. I know this is a massive shot in the dark but I've been having issues recreating your project because my ESP32 can apparently only read the analog pin at 14kHz. Could you share the exact board you are using or if maybe your ArduinoIDE setup is different if possible? Kinda scared to get into possible solutions like I2c. Great video by the way, got me into making stuff at home and not waiting for school projects to start being interesting.
Love this! That is such a beautiful, clean and crisp Matrix that you've put together and looks fantastic with that spectrum analyser running on it. Well done! 👍
Thank you, for your kind comment!
The best video I've ever seen related to FFT!
ESP32 seems to be perfect for all kinds of pixelart. Your videos make me quite interested in making these projects myself.
Hey brother can you please tell if this code runs in Arduino Uno??
Hello. i just bought an ESP32 module, when i try to run your test i got:
14:50:59.321 -> Conversion time: 53.85 uS
14:50:59.321 -> Max sampling frequency: 18570.64 Hz
so under 20KHz... that shouldn't be that low right?
They seem to vary a lot. Not sure why as I'm not an expert on these things! You could build it anyway, it will still look pretty just won't be as accurate. The microphone won't pickuo up to 20kHz anyway
Hey Stefano, I had the same experience with every ESP32 I tried (I think 3 or 4 different in total) being much, much slower than what I saw in videos I watched.
Try running yours with a sampling frequency of 30,000 Hz and 256 Sample Size. From what I tried with mine that seemed to provide decent performance. 40 KHz and 1024 Samples always produces a slideshow for me.
@@EnvoyOfFabulousness i tryed 8kHz and 32 sample, still not working
From other replies, change the version of your esp32 firmware in the arduino IDE boards manager to 1.0.4 as 1.0.5 and 1.0.6 return the slower sampling rates you are experiencing.
How are you getting your ESP to sample that fast? Tested mine and the most I could get it up to is 11.36kHz. I read up about using the I2S peripheral and DMA but there's no mention of that here, and yet you can still get it up to >100kHz. Maybe it's the specific board you have?
Line/headphone input peak to peak voltage is around 2v, so aren't you losing some resolution with the 3.3v ADC?
I just had a try on my esp32 with "Sample_test.ino" and I received very poor conversion time 84.96µS with a max sampling of 11000Hz, reading the comment I found that installing ESP32 1.0.4 version should solve this issue and this is the case I get now 9.23µS and 108332 Hz. I don't know the reason , surely related to clock divider but I can continue now with this amazing project. Thanks a lot.
Thanks
Your videos are excellent Scott. Thank you for making and sharing.
Thank for your support both on here and Reddit. I really appreciate it!
Awesome video - been searching for a great use of FTT - well done!
I'm curious which ESP32 you are using. The one I have is outputting an analog read time of 68uS and thus a max sampling frequency of around 14kHz.
As per one of the comments and responses below, in the boards manager of arduino IDE uninstall the esp32 board version you are currently having and install the 1.0.4 version. I was having the same issue and this fixed the issue for me! Maybe Espressif have to pay attention for this when they release the 1.0.7 update!
Yo you nailed it with this one I am going to try something Similar based on your code and I am super thankful for the code you provide! I was thinking about something like this for many years, even more so since studying fft and your video and the fft library are a big motivation to get going!
Thanks, Scott. Good info. I've been wanting to try this.
Can we do this by using esp8266
hello, I couldn't find instructions for turning the leds vertically and horizontally in the arduino code, can you help?
Since I connected the leds vertically, a horizontal image was formed. how can i rotate
Well explained Scott, for a complete noob like me this is a life saver of a project . I'll try it out and let you know , keep doing cool stuff
I use Board ESP32- Devkit V1. But Max sampling frequency is 16khz. No 100khz. Please help me.
Make sure the clock frequency is set to its maximum, but other than that I have no idea, sorry!
At the boards manager in arduino ide install a previous version of the esp32, the latest 1.0.5 is not as good as an older version.
Did you could solve your problem? my ESP32 clone is showing: Conversion time: 52.93 uS
Max sampling frequency: 18893.39 Hz
I just find: #include "esp32-hal-cpu.h" and
in the setup: setCpuFrequencyMhz(240);
and to read:
Serial.print("CPU Frequency is: ");
Serial.print(getCpuFrequencyMhz()); //Get CPU clock
Serial.print(" Mhz");
Serial.println();
@@jozsefcsiza2760 Thank you very much, it worked for me installing the 1.0.4 version. Conversion time: 9.74 uS
Max sampling frequency: 102671.92 Hz
Hello everyone. i got a question and hopefully someone can help me :)
i wired up my ESP32 (Dev KitC V2 ESP32-WROOM-32) Line in version as you can see @10:48 and dont know what i got to set in the WLED app to make it respond to the sound
Hello, I would like some help with the following:
I have a 7018b touch screen on which I made a boom box
and I want to connect the audio output directly to the Arduino uno that will connect the lieds board
8x32 led RGB panel to the rhythm of the music without using the Sound Sensor. Where can I find the schematic and code? I used sp107e box and it doesn't work properly because the leds go up and down even without music.
i keep on getting error arduinoFFT' does not name a type; did you mean 'ArduinoFFT, while compiling. please help
Hello, excellent video very informative and easy to follow. I have been wanting to build a software spectrum analyser for a while, there is a place that you have shared your FFT calculator?
how to do upload this code for esp 32 board ? . what is select board for arduino IDE ? Please help me. Thank you.
I'm doing something extremely similar and your video has been an extremely helpful resource, I've added a few things like an amplitude balancer. I am running into one issue that I don't see how you overcame.
My analog read function takes 49 microseconds, not 9.7 as documented in code or 10 as mentioned elsewhere. The whole loop takes 52 microseconds and that's a little long for wanting 25 microseconds. I'm struggling trying to find a solution. If you or anyone else knows of one or some hints, That'd be awesome
This might be not be the issue, but have you tried different pins? I think another commenter mentioned that they had a similar issue and using a different pin as input made it faster. I might be wrong though! The other thing to check is the clock speed. Is it set to 240MHz? Other than that I'm not sure, I'm not an expert on this stuff I just document what I make.
Install board support ESP32 1.0.4 version instead of the last one, I just had the same problem
@@jphdor This worked, thank you so much!
@@jphdor This worked for me. I was having a conversion time of ~54 uS and now having ~9.96 uS. Thank you!
Hello. I am making a system similar to this but I need to invert the matrix horizontally and vertically. What path can I follow? my matrix horizontal 6 vertical 20
Look up the adafruit instructions for neomatrix. That explains the things you need to change in the code to rotate the matrix
@@ScottMarley Do you know a link about it?
So I bought my first esp32 for this project. Tested the sampling rate and the highest I can get is is ~12khz. Is there anything I can adjust or do I need to get a different board?
Install board support ESP32 1.0.4 version instead of the last one, I just had the same problem
@@jphdor Thank you !!
Thank you it was helpfull, but i had a question, can I use different band out put in to different GPio pin or output pins?
by doing some adjustments on the code?
Great video. I have just put together a matrix using a string of WS2815 leds, rearnaged into 10 * strips of 16. I've yet to put together the code, so I'll find this very helpful, as I had intended to do something almost identical to your output. I enjoyed your explanation of the FFT, very scuccint. :)
Thank you, best of luck getting everything working!
Hi Scott, I saw your 3D printed spectrum analyzer (amazing project) that uses a INMP441 digital mic and I’m trying to adapt that code to this first version, because I prefer a physical control rather than depending on a smartphone, but my experience with C is limited, and I’m not able to find the exact part that manages the audio input. Could you please help me? TIA.
I know this is a really old video, but would you mind posting your spreadsheet, or the maths that go into it? I'm having a little trouble recreating it, and it would be a MASSIVE help for writing a more generic binning function. Thanks!
It's in the github page
Hello. I need your help with something. I enter the 5V supply from the adapter to the matrix panel, it is also connected to the 5v input of the microprocessor. it's already a simple circuit, after all, there is nothing but a panel and a microphone. When I energize everything works great. After a while, random LEDs start to light up in the animation. Then smoke comes out of the ESP32. what am i missing? Is the panel somehow drawing current from the microprocessor? What should I do to prevent this?
My nodemcu esp32 board only manages 18khz, which is very confusing ... Shouldnt those boards all be the same open source hardware? I reduced the sampling freq to 18khz for now, but results should be worse, i fear. Could you link boards that worked out well for you?
i also came across the problem, that my sensitivity usually is way off. any ideas on how to automatically adjust it?
Hi scot, can you please help me to make your code to run on Nextion Display.... each band data will map to run progress bar property ... eight or 16 progress bar in vertical position of Nextion display. Thank you.
I will use arduino NANO
grazie scott per aver condiviso il tuo lavoro
No problem, I hope it's useful!
Hello Scott Marley,
I have a problem regarding the Max sampling frequency of my ESP32's, running the test shows that the conversion time is 53 µs and therefore the max freq. is only 18kHz which translates to 9kHz Audio.
My ESP's are way slower than yours, do you have a clue?
Hi Yiruma. As mentioned below by Marek Bohumsky If you install the 1.0.4 version of the ESP32 board via the Boards manager and re-run the sample code it does give a result of 9.73uS. I had the same issue and changed the code for the lower sample rate. Now that I have also found the answer (from below) I will try it with the corrected code. Just passing it on, hope this helps.
@@andrewmcwhir8973 Thank you very much, I'll try that! :)
@@andrewmcwhir8973 It works fine, thank you!
@@andrewmcwhir8973 Thanks, that worked for me aswell.
! Thank you so much for the clear description of FFT as well as the library. I'd like to ask if it's possible to read the data from Bluetooth? I mean using the A2DP library to feed audio signal instead of line in. I've seen other people do this but none comes with an explanation of their code. Thanks in advance!
That's a good question, I suppose it should be, but I've never played with the BT stuff on the ESP so I don't know for sure!
Hello, thanks for the amazing video. I already had a DOIT ESP32 unit so i decided do make this. I am already quite far. I only have one issue and that is that my ESP32 has a conversion time of 52.17 uS, so a max sampling freq of 19166.64 Hz
. I am still reading into the documentation in order to improve this. Do you have any leads?
Someone responded to similar problem down below: "If you install the 1.0.4 version of the ESP32 board via the Boards manager and re-run the sample code it does give a result of 9.73uS."
@@tofek321 It actually did the trick. Thanks for the reply.
Good job.
Is it possible to change the code to use a led strip ws2812b instead of the matrix?
I would like to cut the led strip in 8 parts with 30 led and create 8 channels, the first being starting at led 0 to 30 for "center bin 2", from led 31 to 60 for "center bin 4", led 61 to 90 for "center bin 9" .....
It's possible?
sorry for my English.
Yes, that will work fine. Just wire the strips up from one to the next and edit the xy code for however yours is wired up. Mine is simply 16 strips of 16 LEDs wired from one to the next. You will need to understand how the xy code works to make the changes yourself.
@@ScottMarley
For me it is impossible to change the code, I did not understand the code.
Scott Marley could you send me the changes?
thank you.
I'm afraid not, I don't have the time. Spend some time learning how this all works and you'll be able to create your own amazing things!
Hi i have a ESP32 as well, but it isnt nearly as fast as yours, only 10000Hz... eventough the cpu runs on 240mhz, can you help me please?
I get ~18400Hz. Any idea why is the differing results?
Hi Scott, really liked your clear presentation on this. And your project works beautifully. Thank you for sharing.
Great, really glad you got it to work!
I tried writing fft on my own.But It is not efficient enough.complex calculations makes the problem lot harder.Is there an efficient way to implement complex numbers.I used a 2d matrix (2 columns) to do my claculations and I think it makes the program lot slower.And is a buffer with 1024 samples enough to implement ?
The Arduino fft functions have been written to be very efficient, using special techniques to save CPU cycles and RAM. Is there any reason why you want to write your own version? It's not trivial, and you would have to have a good knowledge of both mathematics and C++
@@ScottMarley just for fun actually.I know the mathematics behind it to some extent but im not very much good at c++ and optimization.
@@SLguitarGuy for fun is a good reason! There is info on the Arduino library implementation here wiki.openmusiclabs.com/wiki/ArduinoFFT and it details some of the optimisations that have been made.
@@ScottMarley thank you very much.really appreciate it
Are you selling this? if yes can you pls say the details of this vu meter, And where are you staying now, I’m from India,Kerala.
I’m interested to buy this vu meter
No, it's not for sale. You can make one yourself of you follow the instructions :)
Love this Scott! I'm planning on making something similar and in was going to use the mseq7 but I think I'll use this instead!
Great! It's far less circuitry and much more customisable to do it in software :)
@@ScottMarley cheaper too 😅
@@ScottMarley I had a play around with it this evening and I couldn't get it working properly. Does the audio source need to be amplified? Like would a cable from a phone headphone jack to the esp32 be what's expected?
I wasn't displaying on anything really, I was just printing the value for the top of the line in serial monitor. If I tapped at the line in cable I could see some values, but never anything when playing music.
Any suggestions?
(Btw I was using a board that doesn't have pin 35 or whatever pin you were using , so I tried 32 and 33, both were the same, I update the pin in the code each time too)
No amplification was required for me, works straight from the headphone output of a phone. What values are you printing out, barHeight? And for each channel? Are you using the circuit for line in given on the GitHub page?You can also play with the AMPLITUDE parameter, lower values make it more sensitive (I think, can't quite remember now!). The input pin shouldn't matter, I'm not doing anything clever here ;)
Hey Scott! I really like your Project and I'm trying to build a simliar one. I'm using an ESP-WROOM-32, but my max datarate is 10 times lower than yours. Do you have any idea why this might happen?
I had not even knew the arduino can take fft of input signal, until I watched this video
I would like to be able to use an FFT to decode AFSK on an ESP32 from a microphone, but the process is super sensitive to latency. Any suggestions?
Hello sir please help
How to add (EEPROM memory) for last pattern save option to the software. I don't know anything about coding it possible kindly help me please
Hi Scott. Thanks for amazing video man. FFT on ESP32 wonderous. A quick question. I tried hooking up line in with a 3.5 audio socket, 2 10k res for mono, 100nf for DC filtering and 2 100k for DC biasing. But when I connect my iPod or phone output to this, I get no audio read in pin 35. I tried changing to 34 and 36 too. But there is nothing there.
Do I need to use an analog amplifier when using with PC/Mobile/iPod headphone out?
Thanks for the wonderful explanation about FFT and your code!
An example of a great video on the topic!
hi
how i can use the inmp441 microphone?
Skecth ran slowly, but now it flies...
I had previously commented that, despite following along exactly and trying different board library versions, as suggested in comments, my esp32 ran like a 3 legged dog with asthma, uphill, with a heavy back pack on! However I spotted something (or was that, I missed something) and that was the pin being used in the sketch, pin 35...
When I checked my datasheet, this was not listed on my esp32 as an audio pin so I simply changed it to a pin that was and bingo...
The sketch now runs sub 9uS. :-)
Now whether or not that should have made a difference could be one for debate, but it did solve my problem.
How do you calculate the band width? I need it to use 45 bands
Thank you, a very good explanation of the FFT function, I understood it! so well done.
Hi, I'm hoping you can help me. I have just started with Arduino and have been trying to make a spectrum analyzer using various codes for projects like these downloaded and run in my IDE. I have the latest "arduinoFFT" library 2.0.2 by Enrique Condes but every project I try returns the fault: error: 'arduinoFFT' does not name a type; did you mean 'ArduinoFFT'?
arduinoFFT FFT = arduinoFFT(); I can see the difference between "arduinoFFT" and "ArduinoFFT" but the code obviously works for others so why do I get a fault for each project?
...the reason I ask is it works yet I get several cycles of good data in the bands then it goes haywire fir a few cycles and then the good data comes back. This is constant. Is there some sort of interrupt in the code could be taking place or could it be timing? Any thoughts of what it could be? I am very new to this but I am a quick learner.
That looks very very cool ..huge thanks for the hard work compiling this tutorial...and an excellent explanation of the sampling mechanism....i have tried fft with 8266 devices but when the WiFi is active it seems to make the ADC input 'noisy' ...have you tried this with WiFi running on the esp32 ..I'm now going to order a few Esp32 board's....on a side note have you seen any of Andrew Tuline's fft stuff ?? he's been doing sound reactive fft projects for a few years and has made some quite artistic lighting projects.
Thanks for your comments, it really was a few days work putting that together even though it might not seem like it! I don't have an 8266, but I know on the ESP32 there are two ADCs, and ADC2 is somehow used for the WiFi. So as the 8266 only has 1 ADC, maybe this has to be shared between the analog pin and the WiFi causing interference? Just guessing here though. Andrew is the chap who does the WLED sound reactive port right? I haven't looked at it yet as I wanted to figure out how to do things myself in the first instance, but I do have an idea for a project that WLED would be good for. Stay tuned!
@@ScottMarley ah so that would explain why the esp32 works where the 8266 doesn't ..well i say doesn't I have had it working with an ADS1115 I2C ADC module but you have to jump through hoops to get the sample rate high enough ...you're version is much easier ....here's hoping you're channel grows...anyway bought some ESP32's .
Hi,
Sorry but I regret to say that the code cannot be compiled in Arduino: displays error:
“/home/macieju/Desktop/Arduino_ESP32_FFT/Arduino_ESP32_FFT.ino:136:3: error: 'FFT' was not declared in this scope
FFT.dcRemoval();
Compilation error: invalid use of template-name 'ArduinoFFT' without an argument list”
Use older version of library 1.6xxx
Can you also use a MAX9814? I'm thinking the auto gain could be nice for adapting to volume? I'm making a similar project, it'll actually be a sound reactive infinity cube inspired by one of your other videos. Hopefully it turns out.
Yeah, I dont see why not. I think I've used that before for something. These days I tend to just use digital mics like the INMP441. Much more complicated to set up, bit much better audio quality.
@@ScottMarley Cool, thanks! Can't believe how fast you responded too!
If you would leave out the capacitor on the audio in, wouldn't the ADC just ignore the negative values? That way you'd get double sensitivity on the input and you wouldn't have to discard the negative samples.
You don't want to stress the ADC with negative values, it probably won't hurt it at such low voltages but it's not designed for it. You wouldn't increase, the sensitivity by doing this anyway, in fact you would be losing half the information in your signal. When you say discarding the negative samples, are you talking about discarding half the vReal array? You would still have to do this. Once the FFT has been performed, the vReal array no longer contains the audio samples themselves, but the FFT results. These are two completely different things, and we are just reusing the vReal array for convenience. At first each element in vReal represents a 25uS slice of time, containing the audio level. After the FFT each element in vReal is a frequency bin containing the amplitude of that frequency.
Just to add (as I went off on a tangent there!) The DC blocking cap is there to block the 1.65V from going back into your audio source (phone or whatever). It's not a good idea to inject DC into the output of an audio device like that :)
@@ScottMarley thank you for clarifying :-)
Hi Scott,
You might want to add the line:
#define BRIGHTNESS 200
to your ESP32_FFT_VU ino file just to give your fans a less bumpy ride :-)
Thanks for pointing that out! This was broken by a pull request that I merged, and don't spot this issue at the time. Should be fixed now, although I haven't tested the code. Cheers.
Hi Scott, your project is very cool.
I am currently doing a school project with STM32F103 MINI V3 development board to make a Music LED Spectrum Analyser like yours. May I know which module would you use in the line-in setup for receiving an audio signal from a computer or phone?
Did you test out with microphone setup? How much worse it is compared to line input? looking to get 20-20KHz electret microphone with amp and gain control to make thing easier.
No, too busy to go back an look unfortunately. I did make a whole new VU type thing using a digital INMP441 which you can find on my channel. It's a cool little gadget, but needs some tuning to make it a bit more accurate. Having used the digital mic, I definitely won't be going back to the old analogue ones now though, it's so much less noisy!
Hey @Scott Marley , I know this is quite an old video, but I did have one quick question regarding one of the animations if you were still around?
I have more or less completed this project (Awesome video, major thanks for making this), however, all of the light patterns work correctly apart from the purple and blue gradient one named "purpleBars" in the code. the bars function correctly, however, the purple part is placed randomly among the blue bars rather than at the top as an even gradient as you demonstrated, and seems to be glitch around as the bars shift. Any idea what might be causing this?
Thank you for your time!
I have complied on ESP32 then the result like those. Can you help me. Thanks
Conversion time: 42.34 uS
Max sampling frequency: 23620.24 Hz
Hi Scott, Yet another excellent video. Ive been attempting to use an MSGEQ7 to position a servo based on speech (anamatronic project) ; after looking at your work your ESP32 VU meter project, it would appear it might be a viable alternative to use ArduinoFFT. Im definitely in the 'novice' category when it comes to coding so would be grateful for some assistance. As Im only looking at male/female vocal frequencies, I don't require many bands. I also need to average these and map against the range of a servo. How easy is this to achieve?
Can you show me please how you get the Frequency multiplier per band and the low and the high bin that exist in the Excel
You need to complete everything in the green box on the Excel sheet and everything else is populated automatically. To see how I calculated these, look at the equations in the Excel sheet.
Greetings. First, thanks for the video and for the device and the code for it! Thanks for the hard work! I repeated the device, but several questions appeared, with which I ask you to help. I do not understand well in such crafts so far .. 1) Your vu meter speed is faster than mine. I have a feeling that it slows down, it does not work so smoothly. Is there something wrong with the firmware? (although it may seem to me ..) 2) Everything works only when the ESP32 is connected to the computer via a usb wire. If you power it separately from the power supply, the entire image on the matrix hangs and does not react in any way to the sound / button. What could be the problem?
I love the esp32 but when I run the code, even though I have nothing attached to the ESP32, the middle bands are still being populated with data. Do you know what is going on?
If there is nothing attached at all, the aanlog pin is probably picking up noise. Either that or you have a very noisy power supply perhaps?
Great tutorial. I do not have this led breakout but I will try to adapt your code to work on an optimized and very fast oled library I wrote for SSD1331 and SSD1351 color oleds (96x64) and (128x128).
I have a question for you... what ESP32 Arduino Core version do you used to make this ? I tried your code to get max sampling rate from ADC but using last 2.0.6 core I get about 11Khz max and a sampling time about 90us on Wemos D32.
Instead using ADC over I2S DMA the max sampling rate from core examples sketch is 277 Khz.
Probably something was changed in the core.
Anyway, the library I wrote is hardware optimized and permits very high refresh rate, I can stream videos from microsd up 140 FPS with both ESP8266 and ESP32 so I think results shoud be good and fast. For ESP32 I just used single core, so probably It can be optimized more. But note that SSD1331 have a very small display, about 2.5x2 cm.
Before to do it, I have to use FFT arduino library for a bit different project, I need to acquire audio from I2S microphone use FFT to get a frequency and convert it to midi. I have no problems for midi and others stuff but my problem is FFT library, I never used it. I found a couple of tutorials on how make a spectrum analyzer, but I do not need to get all bands to show, instead i need to just know an most precise possible the dominant frequency that is at higher level, the fundamental of a voice or whistle over a microphone.
You think Great tutorial. I do not have this led beakout but I will try to convert your code to be working on an 96x64 optimized and very fast library I wrote for SSD1331 and SSD1351 color oled. This library is hardware optimized and permits very high refresh rate, I can stream videos from microsd up 140 FPS with both ESP8266 and ESP32. For last I just used single core, so probably It can be optimized more. Before to do it, I have to use FFT arduino library for a bit different project, I need to acquire audio from I2S microphone use FFT to get a frequency and convert it to midi. Please is that possible? I have no problem for midi and others stuff bu my problem is FFT library I never used it. I found a couple of tutorials on how make a spectrum analyzer, but I do not need to get all bands to show, instead i need to just know as most precise possible the dominant frequency that is at higher level, eg. the fundamental of a voice or whistle over a microphone.
Please do you know is that is possible ? Should be realtime...
Many thanks
" It can have any number of bands"
Does the ESP32 have the muscle to support 31 bands? Not that it's needed (I have a 128 band RTA) but the eye-candy would be fantastic.
Hello. Thank you for yet another fantastic video. I've used the suggested code to check the sampling rate of my ESP32 and I'm getting nowhere near what you are. Mine comes out closer to 11 kHz! I don't think I've made a typo in the code... I'm using pin 33 of my uPesy ESP32 Wroom DevKit board. Is there a faster pin, or is this a slow board? Any help would be much appreciated!
Amazing video sir! I just completed the entire circuit and it seems like it's reacting to music accurately, however my bars keep pulsing from right to left. I connected the input to matrix to bottom left, so my question is how can I turn it 90 degrees so it can pulse from bottom to top? Is it located here:
// XY code for serpentine matrix with input in top left
uint16_t XY( uint8_t x, uint8_t y) {
uint16_t i;
y = kMatrixHeight - 1 - y; // Adjust y coordinate so (0,0) is bottom left
if(SERPENTINE) {
if( y & 0x01) {
// Odd rows run backwards
uint8_t reverseX = (kMatrixWidth - 1) - x;
i = (y * kMatrixWidth) + reverseX;
} else {
// Even rows run forwards
i = (y * kMatrixWidth) + x;
}
}
else {
i = (y * kMatrixWidth) + x;
}
return i;
}
.
If so what parameters do I have to change so it does what I want it to do? (BTW I wired my matrix in PROGRESSIVE configuration/all led strips are facing the same direction). Thank you in advance, I'm looking forward to the next project.
maybe you find my answer to
rasheed el hanout helpful (further down the comments)
@@marcosanti2357 OMG that actually worked!!! Thx a bunch dude. I had to play around with the code a bit, but regardless it works perfectly. Here's how this section of the code looks now:
// XY code for serpentine matrix with input in top left
uint16_t XY( uint8_t x, uint8_t y) {
// Rotation counterclockwise
//uint8_t tmpX = x;
//x = -y + kMatrixHeight - 1;
//y = tmpX;
//Rotation clockwise
uint8_t tmpX = x;
x = y;
y = -tmpX + kMatrixWidth - 1;
uint16_t i;
y = kMatrixHeight - 1 - y; // Adjust y coordinate so (0,0) is bottom left
// Even rows run forwards
i = (y * kMatrixHeight) + x;
return i;
}
Great, glad you've got it sorted!
Hi Scott, i built my own version with 24 bands, sadly some of the frequency bands on the top part are always maxed out... any ideas what could cause that? (Seems to be affected by the brightness of the matrix, so maybe something corelating with the max amps flowing?) Thanks for the awesome walkthrough video, had alot of fun with this project!
I have also faced that and here are some of the reasons/solutions -
1. Top bands sum up many frequency bins - so small errors get summed up. Reducing the upper range of max band (264-380 instead of 264-512) helped. Adding a per-band noise level helped (500 for lower band, 1500 for highest band).
2. Changed the amplitude sum to bar height mapping - made it logarithmic scale and used some y = a + bx + cx**2 formula. For ex. when your Tv/computer is at 50% volume, the amplitude is not half of max amplitude, it's probably around 1/4th.
Hi Scott,
Can I use ws2811 led strip instead of ws2812 without changing the code ?
thank you.
Yes, don't see why not. You might need a level shifter between the data pin on the esp and the led Din, but it might work without.
Thank you for the fantastic video, very well explained and demonstrated.
Nice work!
Did you take the line from the amplified signal, in parallel with the loudspeakers?
No impedance change in the loudspeakers nor spurious interferences to the signal, giving distortions?
No, it takes a line-in. Be careful if you use the speaker cable. The maximum input voltage on an ESP is 3.3V, speakers are driven far higher than that usually so you would need a voltage divider etc.
@@ScottMarley Thank you for the reply. I was afraid that the line-in level was too low and should be amplifieed..
@@luigimorelli6444 make sure you look at the circuit diagram on GitHub. It is very low level, but that's ok. I actually find it works best using a microphone instead.
Really great and helpful:) But I was wondering if you could tell me how you calculated the frequency multiplier and the center bin, because I can't find any information about that in the video and I'm new to FFT so this really would be helpful. Thank you:)
It's a bit difficult to explain in a comment here. Have a look at the Excel sheet on GitHub, and all the equations are in the appropriate cells. You can work backwards from whatever you're trying to figure out!
@@ScottMarley oh, should have done that in the first place, kinda forgot. Thank you very much
so i've tried this and it works so far. I also tried to split the line in so that I can plug in my headphone but then it stopped working for some reasons. Could it be the voltage drop after splitting?
This seems to work with some inputs and not others. I believe it is to do with the impedence of the things that are plugged into it, causing a voltage drop as you say. The 'proper' way to do this would be to use an opamp as a buffer between the connected devices (as they have very high input impedance), but was a bit complicated to show in this video.
Adding on to this, if I slap a buffer/voltage follower with an ne5532 right before the esp32 input pin, that should work a treat for this problem right?
Hi Scott, your project is very very very cool.
Scott this product is amazing and your vu meter fft calculator looks better then any I seen online. Do you have a video on how u set up your Vu meter calculator on excel or file for calculator? I'm a beginner and your explanations are easy to follow even with no experience.
The excel file is in the github link in the description if you want to take a look.
Hi. Would it work if i make a matrix 8 bands/strips and 20 leds/band with ws2812b strips? Thx in advance
Arduino: 1.8.19 (Windows 10), TD: 1.57, Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
Marley_spectrum_analyser:46:28: fatal error: audio_reactive.h: No such file or directory
compilation terminated.
exit status 1
audio_reactive.h: No such file or directory
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
This is the message I get, the library is not listed in my library, please help !
this is an amazing project and has inspired me to make a large 50x19 led matrix using this code. i cant seem to find the excel spread sheet you used to map out your bands to finish the code. did you make it your self or did you find it online somewhere? I don't think guessing would provide a good look for my bands. keep up the great work!
Hi Tobiah, it's on github with the rest of the code. Its called FFT.xlsx
@@ScottMarley okay thank you. I must not have seen it while looking through it. Thank you very much! Keep up the awesome work!
Hello Scott, I used your code and made a spectrum analyzer and edited your code a little, which of course turned out to be very beautiful. I made this device in 24 bands and 18 pixels high. But the audio analysis speed is a little lower than your device... Is there a way to increase the speed? In addition, I tried a lot to create a peak pause, but unfortunately I haven't succeeded yet... Do you have a way to solve these issues? Thank you very much.. by the way I am new to coding!
hi,,?? code for wimos d1 mini... please
Great video... I'm still just getting my feet wet with Arduino IDE and ESP32 programming. I've made a few matrices but I have one in mind specifically for use as a spectrum analyzer/VU meter which would be integrated into another project, but if I follow along with this code and tutorial I believe my display will be skewed 90 degrees from how I'd like it to display. It would be a 12x12 matrix in terms of pixels, but the horizontal and vertical spacing wouldn't be equal (overall dimensions approx 10"x32". Specifically it'd be 12 strips of 12 60/m WS2812b's (so about 7" in length) spaced about 2.5" apart, and I'd want to view it horizontally. I believe if I wired it as you have, it would produce 12 3' tall bands vertically. Do you know if there Is there a way to modify the code to essentially shift what is being displayed 90°?
The code is written using the neomatrix library making it possible to use on any wiring direction and in any orientation. See learn.adafruit.com/adafruit-neopixel-uberguide/neomatrix-library for how to set it up.
when loading a sketch, writes- JC_Button.h-no such file or directory.
How to fix this problem?
Are you using old the old code? The latest version on GitHub doesn't use JC_Button
@@ScottMarley cant to load a new code to-with new code writing-easy butto-invalid argument
what the number of micro prog.version the esp 32?
@@pavelkonjok7201 let me have a look when I get home from work, but I'm pretty sure it works for me.
Hi sir,would like to ask if the led you are using was created manually using ws2812 led strip or not? Thanks.
This one was made with LED strip. See here for more info ua-cam.com/video/_0a9JZLGu4M/v-deo.html, although before I made this video (the vu meter) I rewired it so that data went in a zig zag rather than always in one direction