Microphone to pickup a combination of musical notes

I'm looking to pickup the frequency of a piano playing notes in a certain order (to eventually unlock something), but I'm having trouble figuring out how to read the frequencies. I bought a Make-It sensor kit from radioshack that has a microphone sensor. I've plugged in the appropriate A0, 5V, and Ground pins, on my R3 Plus, and now I'm trying to process the inputs. I've read to use FFT, but I can't seem to get it to work. After searching the internet for a few hours I'm at the end of my rope. Is there a simple tutorial anyone knows of to get the frequency input of a setup like this.

The FFT examples both fail on upload, and I've also tried messing with FreqCounter and FreqMeasurement and can't get anything simple working.

ANY help would be VERY much appreciated.

Which examples did you use ? do you have a link?

well I’ve used multiple different examples. I used the serial_output example for freqMeasure, but the output is always different for the same note being played:

```/* FreqMeasure - Example with serial output
* http://www.pjrc.com/teensy/td_libs_FreqMeasure.html
*
* This example code is in the public domain.
*/
#include

void setup() {
Serial.begin(57600);
FreqMeasure.begin();
}

double sum=0;
int count=0;

void loop() {
if (FreqMeasure.available()) {
count = count + 1;
if (count > 30) {
float frequency = FreqMeasure.countToFrequency(sum / count);
Serial.println(frequency);
sum = 0;
count = 0;
}
}
}
```

I’ve upped the count to 90 instead of 30 and it is still really inconsistent ranging from 15 to 330 for the same G note being played

tmcornelius: ... the output is always different for the same note being played

That's because the library estimates frequency by measuring the time between zero crossings. The piano generates a complex sound, with multiple harmonics. Those harmonics are constantly shifting in phase relative to the fundamental. Sometimes the sound wave crosses zero more than once during a cycle, and sometimes it doesn't. With a complicated sound, there's no telling what you'll get by looking at zero crossings. This library probably won't help you with a piano as input.

tmcornelius: I'm looking to pickup the frequency of a piano playing notes in a certain order ...

Tell us what range of notes you hope to use for this.

... can't get anything simple working.

I hope that other readers will answer this: Has anybody ever managed to reliably estimate frequency using the FFT and an Arduino? I can recall lots of frustrated experimenters talking about their travails, but I can't remember anyone who said, "Finally, I got it to work."

This is a virtually impossible task on any machine let alone the small memory limited low CPU Arduino.

An FFT is your only hope. Even then it will only be good at spotting notes within an octave, that is you will have difficulty separating a high C from a low C.

The FFT examples both fail on upload,

Probably because some of the library are old they need updating.