PDA

View Full Version : Teensy - running FFT and export "result" to a PC?



marin1454
03-30-2016, 12:34 PM
Hi, im planning to do a sound project where i will be using some filters and some others functions to analyze a sound source, but for now i want to start up by running a FFT to see what kind of frequencys i have in the background, and what kind of filters i will be needing.

So my plan is to start by using the Teensy 3.2 with a microphone, to record some sound, run a FFT and "export/transfer" it to a PC. How would I do that?

The current tools i have avalibe for the audio process is, a Teensy 3.2, Teensy official audio board, a microphone, windows PC with matlab? -

What/How can i get a "visual" FFT out of the teensy to my PC?

PaulStoffregen
03-30-2016, 01:17 PM
First, if you haven't yet done the tutorial (www.pjrc.com/store/audio_tutorial_kit.html) or run the FFT example, at least start by getting that running. Adding code on both the Teensy side and PC side is going to introduce a lot of extra stuff to troubleshoot, so for your own sanity, start from a point where you know you can run the examples or tutorial and see the first couple dozen bins printing in the Arduino Serial Monitor.

To print all the data to your PC, you could try extending the FFT examples to just print all the bins. But the problem is the FFT object gives you new data 86 times per second, so if that process takes longer than 1/86th of a second, you could end up printing some of the FFT from one analysis and other data from the next analysis. If that's a concern, perhaps add a some code to create another 512 array and copy all 512 bins of FFT data. The copy will complete quickly. Then you can print it to your PC without worrying if it changes while transmitting so much data.

On the PC side, I'd first get that code working by viewing in the Arduino Serial Monitor. Then try using Coolterm, which can capture the serial data to a file.

From there, lots of programs can read a text file of numbers and print a graph. Even Excel or OpenOffice / LibreOffice could do this.

Of course, you could write code on the PC side too if you like. That's up to you.

marin1454
03-31-2016, 07:43 AM
Allright - then i will plan to make he 512 array, and then send it through serial, and capture with coolterm and then run it through matlab - thanks :)