Frequency Measurement of a Guitar String.
hi everybody,
so have been using frequency library measure frequency of guitar string. have wired guitar pickup 4th order low pass filter isolate fundamental frequency of string. signal passed through comparator , voltage regulator. end result square maximum voltage of 4v.
here's link library if interested: https://www.pjrc.com/teensy/td_libs_freqmeasure.html
here code:
now code works fine if frequency constant (e.g. input frequency function generator). however, when test on guitar range of frequencies. below 80 hz due transient nature of string.
i want add code arduino can pick out 80 hz seen in image , ignore other printed values. have attached image below.
any appreciated.
thanks.
so have been using frequency library measure frequency of guitar string. have wired guitar pickup 4th order low pass filter isolate fundamental frequency of string. signal passed through comparator , voltage regulator. end result square maximum voltage of 4v.
here's link library if interested: https://www.pjrc.com/teensy/td_libs_freqmeasure.html
here code:
code: [select]
#include <freqmeasure.h>
void setup() {
serial.begin(57600);
freqmeasure.begin();
}
double sum=0;
int count=0;
void loop() {
if (freqmeasure.available()) {
sum = sum + freqmeasure.read();
count = count + 1;
if (count > 30) {
float frequency = freqmeasure.counttofrequency(sum / count);
serial.println(frequency);
sum = 0;
count = 0;
}
}
}
now code works fine if frequency constant (e.g. input frequency function generator). however, when test on guitar range of frequencies. below 80 hz due transient nature of string.
i want add code arduino can pick out 80 hz seen in image , ignore other printed values. have attached image below.
any appreciated.
thanks.
maybe average 10 readings, throwing out data points more 10% below current average?
code: [select]
float average = getfrequency();
for (int i=1; i<=10; ) {
float frequency = getfrequency();
if (frequency < (0.9 * (average/i)))
continue; // skip sample
average += frequency;
i++;
}
Arduino Forum > Using Arduino > Project Guidance > Frequency Measurement of a Guitar String.
arduino
Comments
Post a Comment