Teensy3.0/3.1 Audio Library Perform FFT on analoginput pin without Audio Shield

kian79

Member
Hi,

I have a question regarding perform FFT on an analogpin pin on Teensy3.0 without using the Audio Shield.

In the Audio System Design Tool, when using the acd1 block, in the info section, there is a recommended circuitry to use. May I know the purpose of this circuitry. Can't I just connect a microphone breakout board (http://www.adafruit.com/product/1063) directly to the teensy (Gnd, 3.3V and A2). Is it because the default signal range used by the audio library is 0 to 1.2V? So the circuit is used to bias the microphone signal output to fluctuate between 0 to 1.2? In that case is it possible to change this signal range to 0 to 3.3V instead so that I can do away with those additional resistors and capacitors in the microphone circuit.

Another question... I just want to perform a 1024 point FFT on a signal picked up by an external eletrect microphone. What advantage is there to use the audio shield as compared to just connecting the microphone directly to the analoginput pin on the teensy? I am looking at a sampling rate of 44100 Hz. If I were to use the audio shield, should I connect the microphone to the mic input or to the line in input? The microphone breakout board from Adafruit already has the biasing circuit.


Cheers,
Kian
 
Is it because the default signal range used by the audio library is 0 to 1.2V?

Yes, exactly.

If your signal already has a 0.6V DC offset, and if it's approx the right level, you could connect it directly.

In that case is it possible to change this signal range to 0 to 3.3V instead so that I can do away with those additional resistors and capacitors in the microphone circuit.

It may be possible with quite a bit of hacking in the code, to change the ADC reference.

But there's no "easy" way to change this, without editing the library code.


What advantage is there to use the audio shield as compared to just connecting the microphone directly to the analoginput pin on the teensy?

The mic input on the audio shield has a bias current circuit those microphones require, and an amplifier to increase its signal.


If I were to use the audio shield, should I connect the microphone to the mic input or to the line in input? The microphone breakout board from Adafruit already has the biasing circuit.

You could probably connect Adafruit's amplified signal to the line-in input. The default input range is also about 1.2V, but with the audio shield, that range is easily changed.

http://www.pjrc.com/teensy/gui/?info=AudioControlSGTL5000

On the right panel, scroll down to "Signal Levels". You'd use lineInLevel() to adjust the audio shield's line-in to approx match whatever output Adafruit's product sends.
 
Thanks Paul for the reply.

Just to further followup on this, is it possible to achieve similar performance of having 44.1kHz sampling rate and 1024 point FFT without using the audio shield and just connecting the mic to an analog input pin?

There is an example of performing FFT on a Teensy3.0 on Adafruit tutorial:
https://learn.adafruit.com/fft-fun-with-fourier-transforms/hardware

They did not use the library, but instead just used the CMSIS library directly. In trheir codes, they only achieve 9kHz sampling rate with a 256 point FFT. In the codes, there was a comment:
// Size of the FFT. Realistically can only be at most 256
// without running out of memory for buffers and other state.

So how did the audio library achieve a much higher sampling rate and higher number of FFT points? Does the audio library use the same CMSIS library?
 
hello,
I'm also working on the same solution discussed by kian79 on a Teensy 3.1, and I tried to set a different size of FFT in the adafruit sketch. Strangely if I set the FFT_SIZE on 512, I cannot read the serial. If I set it on 1024, the sketch works even if not as fluid as the original, but printing the results on serial stopping for a few tenths of a second between some prints and others.
It is not a problem, but I wonder if it is not using bad the memory and this can not cause some unexpected error (that I didn't found after a few tests).
Do you have any idea or suggestion about it? I have to change some parameters to properly use the memory?
Thanks
 
Last edited:
Back
Top