potatotron
Well-known member
Here's my first circuit to test the Teensy audio adapter's microphone capabilities.
The audio adapter has a generic electret microphone (I think it's 'KEB6550PF' from http://www.futurlec.com/Microphones.shtml) and connects to the Teensy via the SGTL5000 pins (9,11,13,18,19,22,23).
The LEDs are connected via a 74HCT245 and 100 Ohm resistors per the OctoWS2811 library.
Like others, I had problems getting the OctoWS2811 and Audio libraries to play nice with each other -- either the code would lock up in setup() or I'd never get any data from myFFT.available(). I tried redownloading the latest versions of the libraries from github and recompiling but no luck; finally I found I'd been putting my (newer) copies in my Documents/Arduino/libraries dir but there was still an older copy of WS2811 in the Arduino program folder (C:/Program Files/Arduino/libraries in Windows) that Teensyduino installed. Deleting that old version fixed things.
Here's what it looks like:
My code is based on the Audio library's SpectrumAnalyzer example but I used fewer FFT bins for the left LED bars (lower frequency) and more for the right bars (higher frequency) because it looked better than the example's linear distribution.
I say "mostly" working in my title because it's still a little glitchy. Here's some examples of what happens at random intervals (sometimes several times per second, sometimes a few seconds between glitches, never consistently).
If I run the OctoWS2811 examples, or if use my program but comment out all the audio code and use random data instead of FFT samples there's never any glitching.
There also isn't any glitching if I comment out just the audio output lines e.g.
but then the FFT analyzer stops working, which is consistent with this thread:
http://forum.pjrc.com/threads/26303...dio-Board-Teensy-3-1-Microphone-input-for-FFT
There's another thread with comments from Paul that Teensy+OctoWS2811+Audio adapter should work, but with others having flickering issues here:
http://forum.pjrc.com/threads/25588-OctoWS2811-flicker
Unless I'm reading wrong it looks like Paul's only using the Audio output and no input, so maybe it works for him because there's no I2S audio read? I'm speculating but maybe it's an intermittent problem where once in a while the trifecta of I2S audio read + OctoWS2811 DMA + I2S audio write step on each other and glitch?. I will keep working on it.
For completeness I'm posing my code; I apologize for the unreadability of it.
View attachment EQTest.ino
The audio adapter has a generic electret microphone (I think it's 'KEB6550PF' from http://www.futurlec.com/Microphones.shtml) and connects to the Teensy via the SGTL5000 pins (9,11,13,18,19,22,23).
The LEDs are connected via a 74HCT245 and 100 Ohm resistors per the OctoWS2811 library.
Like others, I had problems getting the OctoWS2811 and Audio libraries to play nice with each other -- either the code would lock up in setup() or I'd never get any data from myFFT.available(). I tried redownloading the latest versions of the libraries from github and recompiling but no luck; finally I found I'd been putting my (newer) copies in my Documents/Arduino/libraries dir but there was still an older copy of WS2811 in the Arduino program folder (C:/Program Files/Arduino/libraries in Windows) that Teensyduino installed. Deleting that old version fixed things.
Here's what it looks like:
My code is based on the Audio library's SpectrumAnalyzer example but I used fewer FFT bins for the left LED bars (lower frequency) and more for the right bars (higher frequency) because it looked better than the example's linear distribution.
I say "mostly" working in my title because it's still a little glitchy. Here's some examples of what happens at random intervals (sometimes several times per second, sometimes a few seconds between glitches, never consistently).
If I run the OctoWS2811 examples, or if use my program but comment out all the audio code and use random data instead of FFT samples there's never any glitching.
There also isn't any glitching if I comment out just the audio output lines e.g.
Code:
//AudioOutputI2S audioOutput; // audio shield: headphones & line-out
// Create Audio connections between the components
//
//AudioConnection c1(audioInput, 0, audioOutput, 0);
AudioConnection c2(audioInput, 0, myFFT, 0);
//AudioConnection c3(audioInput, 1, audioOutput, 1);
but then the FFT analyzer stops working, which is consistent with this thread:
http://forum.pjrc.com/threads/26303...dio-Board-Teensy-3-1-Microphone-input-for-FFT
There's another thread with comments from Paul that Teensy+OctoWS2811+Audio adapter should work, but with others having flickering issues here:
http://forum.pjrc.com/threads/25588-OctoWS2811-flicker
Unless I'm reading wrong it looks like Paul's only using the Audio output and no input, so maybe it works for him because there's no I2S audio read? I'm speculating but maybe it's an intermittent problem where once in a while the trifecta of I2S audio read + OctoWS2811 DMA + I2S audio write step on each other and glitch?. I will keep working on it.
For completeness I'm posing my code; I apologize for the unreadability of it.
View attachment EQTest.ino