Has anyone gotten pitch detection to work on an ADC input pin?
I am trying to do this and all I get out of serial is garbage, and then it freezes.
Here is the code I am trying:
I have tried various values for the threshold with no luck. Also tried various clock speeds. I know of the bug at 72Mhz for the ADC input. Also have tried a second Teensy! Peak detection seems to work fine, but no go for noteFreq.
I am trying to do this and all I get out of serial is garbage, and then it freezes.
Here is the code I am trying:
Code:
#include <Audio.h>
#include <SPI.h>
#include <Wire.h>
#define kSerialSpeed 115200
AudioInputAnalog adc(A6);
AudioAnalyzeNoteFrequency notefreq;
AudioConnection patchCord1(adc, 0, notefreq, 0);
void setup() {
AudioMemory(30);
notefreq.begin(.15);
Serial.begin(kSerialSpeed);
}
void loop() {
if (notefreq.available()) {
float note = notefreq.read();
float prob = notefreq.probability();
Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob);
}
}
I have tried various values for the threshold with no luck. Also tried various clock speeds. I know of the bug at 72Mhz for the ADC input. Also have tried a second Teensy! Peak detection seems to work fine, but no go for noteFreq.
Last edited: