Oooh, check it out: the volume from a Sparkfun mic/preamp board controlling the number of LEDs lit (with a potentiometer connected to an analogue pin to adjust the “gain”) and a rotary encoder adjusting the hue value! All running on a Teensy 3.0.
This is the basis of the control box for my jacket this year. Some patterns will be sound activated and I can adjust the “strength” of that input from the pot, but use the rotary encoder to change the master brightness (with the shaft button “up”) or change patterns (with the shaft button pressed.)
All surprisingly easy to get working. I surprised myself, anyhow
[edited, because G+'s interface is obtuse and I posted the wrong video]
No FFT. I’m betting that the raw volume of any given kick drum beat will overpower everything else to the point where it’s not necessary to spend the processing power on FFT.
@Robert_Atkins this is fantastic! I’m working on a project very similar to this. I’m affixing 300 2811 based leds to a bicycle with a battery pack and a teensy 3.1 as the controller. I’m still struggling with getting a good sketch for using a mic opamp circuit (sparkfun/adafruit breakout). Do you connect the mic directly to an analog pin? I would love some guidance on how to get mic input working for changing pixel hue or brightness.
Connecting the Sparkfun mic breakout (https://www.sparkfun.com/products/9964) was really easy in the end. Just hook up VCC, GND and AUD on the breakout to VCC, AREF and an analogue pin on the Teensy. When you print out the values you’re getting from the analogue pin, you’ll see they hover around 500 when it’s quiet, and go up to 1023 when you clap. So map() the 500-1023 input range to whatever output range you want (probably 0-255 to control a hue, or saturation or whatever.)
I did some experiments ages ago with low pass filters made of passives and things; turns out if you just want to have your piece react to a beat, putting your thumb over the mic is as good a low-pass filter as any.
@Robert_Atkins That would be awesome! I was successful in just using my adafruit mic opamp circuit (similar to the spark fun one) and getting some basic FFT going. I’m going to start putting some knobs and a power button into an enclosure along with the teensy and mic for mounting on the bikes. Your approach of just using amplitude seems more efficient than FFT. I’m going to try to get FunkyClouds audio examples to work without the use of an MSGEQ7.
Is there any reason I should use AREF and not just grd, vcc, and an analog pin (like 14) to handle the mic input? I’m still learning all the pinout functions on the teensy.
I don’t know actually, it just seems more appropriate and it worked well. Any of the hardware engineers clue us in to the difference between AREF and ground?
I’ve looked it up, and it appears I’m doin’ it wrong. I should leave AREF unconnected and use the (default?) VCC analogue reference, as I’m reading from my pots and switches relative to the board VCC: https://www.pjrc.com/teensy/adc.html
@Robert_Atkins Ah cool! I only asked originally because I had got a similar result just using ground, VCC, and output to an analog pin and it seemed to work as well and wanted to make sure I wasn’t going to lose something if I did it that way.
Wait, wait, I’m really effing confused about this apparently: the pin on the Teensy is marked “AGND”, (not AREF), and it is meant to be used for what I was using it for—the ground side of any analogue components like pots. See this post from the P in PRJC (makers of the teensy): http://forum.pjrc.com/threads/25016-teensy-3-1-ground-pins?p=41178&viewfull=1#post41178