Audio spectrum analyzer powered by a Teensy 3.1 and an MSGEQ7.

fastled-showtell
gplus
(Mat Bettinson) #1

Audio spectrum analyzer powered by a Teensy 3.1 and an MSGEQ7. 7 x 42 LEDs. The code needs work yet, and the microphone circuit is still noisy despite my best efforts.
https://www.youtube.com/watch?v=HhP0erBrPlI

(Mark Kriegsman) #2

Super cool looking!
Any code or construction tips to share about it?

(Mat Bettinson) #3

Actually the build was easier than I expected. The led strips were first stuck on paddle pop sticks to make them properly flat. The hardest thing to achieve was to get a proper microphone amp working acceptably because I want it to work where a simple line in wont suffice, e.g. at jams.

Code wise, it’s pretty basic in that the analog voltage from the MSGEQ7 is converted to both brightness and hue (HSV) for each of the 7 pixels on the left and then it simply copies the whole lot one led along to scroll the display when it’s time for a new value.

I keep track of the highest and lowest values obtained in each band over time to get the dynamic range of each band, and then this range is scaled to the desired output level. This works quite nicely as a sort of auto scaler to cope with different input levels. Still lots of toying on the code. I’d like to put in a BPM calculator and maybe some sort of alpha faded text display. So it’s early days :slight_smile:

(Robert Atkins) #4

And WHY exactly did you guys not tell me about the existence of the MSGEQ7 until now? :stuck_out_tongue_winking_eye:

(Mat Bettinson) #5

Heh, they’re pretty popular. Just don’t buy them on eBay. I spent days trying to work out why I was getting garbage out until I noticed a comment on Sparkfun about dodgy chips on eBay…

(Daniel Garcia) #6

@Robert_Atkins , I have mentioned the msgeq7 multiple times, it’s a fantastic little chip! I believe spark fun has a shield for it. I’d love to fund a good breakout board that combined with a small mic and opamp.

(Mat Bettinson) #7

Not a terrible idea. The mic + opamp is the hard bit to get nice and clean. Any hum or hiss and it really hits your results.

(Justin Eastman) #8

Just got one of these…
http://www.pjrc.com/store/teensy3_audio.html

I have a MSGEQ7 but why limit yourself to 7 bands? Need to find the time to implement but I saw an example of 128 bands somewhere I think…

(Mat Bettinson) #9

By fiddling with the offsets? On the surface a nice idea but people who propose these ideas tend to overlook the fixed Q of the filters. You’ll get so much overlap to be meaningless. If you really want more bands it would be far more profitable to use a beefy controller that can run real time FFTs.

(Ashley M. Kirchner [Norym]) #10

@Robert_Atkins Several of us have been playing with those for some time now. I’m surprised you haven’t picked up on that. One of the images I posted yesterday about AS6 with Visual Micro has a spectrum analyzer sketch running using that chip, spitting out the values to the serial window.

(Mat Bettinson) #11

@Justin_Eastman like the teensy 3.1, with that audio add on!

(Justin Eastman) #12

My intention is to do fast FFTs and 128 bands is far outside of what I both have the clock to do and way overkill. However, I would like something like 24 bands. I also just want real sound interactivity and no one to really analyze it for accuracy.

(Justin Eastman) #13

I honestly have not messed around with it much because I have heard of so much trouble with the noise with using a mic… I don’t want to push a audio line it but rather be "listen"ing

(Mat Bettinson) #14

Okay, I thought you were talking about using multiple msgeq7s at first, so we were at cross purposes there. FFTs are certainly desirable but then you’d probably have to leave arduino IDE behind if you wanted to pull in some code? Obviously it’s waaaay outside the realms of normal arduino land, teensy aside.

(Justin Eastman) #15

perhaps you missed the link… its an audio sheild for a teensy… plenty of processing for FFTs

(Mat Bettinson) #16

Gah, I know… I’m talking about what IDE you’re programming the teensy sigh.

(Mat Bettinson) #17

, sorry teensy WITH, ipad autocorrect getting carried away.

(Justin Eastman) #18

http://forum.arduino.cc/index.php/topic,38153.0.html

(Justin Eastman) #19

Been meaning to try it out with a pro328 and then just I2C the values to the other one pushing the LEDs… just need to expand time a bit to figure out when to do that : )

(Mat Bettinson) #20

I don’t think id call an 8 bit fft hack to be superior to using an msgeq7… Would be a horrific shackle to performance and accuracy.