PDA

View Full Version : Pipe organ tuner



LERAY
03-11-2016, 08:22 AM
Dear all,
I'm using the Audio Shield for Pipe Organ tuning.
I am using Arduino 1.6.7
I wrote the following program, which outputs only a constant value, when sending a .wav file via the Line Out connector of a PC running XP.
Thanks for your help !

Pascal Leray

#include <Wire.h>
#include <Audio.h>
#include <analyze_notefreq.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <FreqMeasure.h>
#define LED 13

// GUItool: begin automatically generated code
AudioPlaySdWav playWav1;
AudioInputAnalog adc1; //xy=173,172
AudioAnalyzePeak peak1;
AudioInputI2S i2s2; //xy=177,419
AudioAnalyzeNoteFrequency notefreq1; //xy=361,413
AudioOutputAnalog dac1; //xy=533,174
AudioConnection patchCord1(adc1, dac1);
AudioConnection patchCord2(i2s2, 0, notefreq1, 0);
AudioControlSGTL5000 sgtl5000_1;
// GUItool: end automatically generated code
float note;
float prob;
long temps = 0;

void setup()
{
// put your setup code here, to run once:
delay(10);
AudioMemory(50);

sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
Serial.begin(9600);
notefreq1.begin(1.);
pinMode(LED, OUTPUT);

}

void loop()
{
// put your main code here, to run repeatedly:
delay(100);
digitalWrite(LED, HIGH);
delay(100);
if(notefreq1.available())
{
note = notefreq1.read();
prob = notefreq1.probability();
// Serial.printf("%ld Note: %3.2f | Probability: %.2f\n", temps,note, prob);
}
Serial.printf("%ld Note: %3.2f | Probability: %.2f\n", temps,note, prob);
temps++;

digitalWrite(LED, LOW);

}

PaulStoffregen
03-11-2016, 12:30 PM
Thanks for your help !


I missed your question. What sort of help did you want?

LERAY
03-11-2016, 12:34 PM
The program is only giving a constant frequency value. Even when no signal is sent to the audio inputs.
May be some statements are missing ?
Thanks foryour help !

Pascal