FFT in MakeCode
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

FFT in MakeCode

by flounder on Wed Oct 28, 2020 2:50 pm

I had a simple idea for a Halloween project. It involves using a Circuit Playground Express, getting input from its microphone, doing an FFT, and taking some actions.

You would think this would be easy.

I can't figure out how to do it.

I tried using the "use the microphone" code from https://learn.adafruit.com/circuit-play ... microphone, but it fails to compile for what I can best determine are deep failures in the header files. I have reported this already in the CPE forum. I tried to trace what was going on, but the Arduino IDE environment is essentially hostile to this kind of analysis.

So, I thought, I will try CircuitPython. No luck there, either. The examples are overly elaborate, require a Clue, which is not what I want to use for this project, and provide no stripped down example equivalent to the microphone example. My need is simple: read a half-second of sound, do an FFT, do something with that, repeat.

Well, OK, what about MakeCode. Surely there is a way, using MakeCode, to do something this simple. Not as far as I can tell. Again, nothing that shows how to do something simple on a CPE. I don't care if it can be done on a Teensy, or a Clue; I care that I can get a piece of code that runs, possibly poorly, on any MakeCode device, and does exactly one thing: reads a sample sound and does an FFT. Nothing else. Trying to strip out all the stuff I don't need should not be necessary.

So where do I go to get a simple program that actually compiles and runs, in C++, CircuitPython, or MakeCode, and does nothing more elaborate than what I have described.

Posts: 465
Joined: Wed Sep 18, 2013 9:10 pm
Location: Pittsburgh PA

Re: FFT in MakeCode

by kevinjwalters on Wed Oct 28, 2020 9:35 pm

There's some code in https://github.com/adafruit/Adafruit_Ze ... r/examples but perhaps it's similar to what you've already tried?

Posts: 963
Joined: Sun Oct 01, 2017 3:15 pm

Please be positive and constructive with your questions and comments.