Hi,
proud to be now also part of this forum.
And of course I have an issue I don`t know how to solve :/
I want to use the YIN frequency detection “notefreq” for my project.
The problem is that “notefreq” spits out a noise frequency of 83Hz (at CPU speed 48Mhz) even if it`s completely silence.
But let`s recapitulate...
My equipment:
Hardware
Teensy 3.2
Audioboard
Microphone
Software:
arduino-1.6.11-windows.exe
TeensyduinoInstall_1.30.exe
Firstly I have test “notefreq” algorithm which a lot of recordings. I transformed my wav files with wav2sketch and include it to the example NoteFrequency:
File > Examples > Audio > Analysis > NoteFrequency
It works fine.
Next step was to test the mic... video tutorial and documentation helped me:
https://www.youtube.com/watch?v=wqt55OAabVs
See Part 2-4: Using the Microphone
https://github.com/PaulStoffregen/AudioWorkshop2015/raw/master/workshop.pdf
Also until this point everything ok. Mic and output to my stereo works fine!
Next step:
Design of note frequency detection via mic.
At that point serial monitor gives me ca. 83Hz…
To understand the problem better I connect also the output (to stereo) to hear what happens.
Now I heard that noise which gets a little bit louder every time it prints out a new line to serial monitor. If I halve the CPU to 24Mhz the frequency duplicates to ca. 170Hz.
Has anyone else got this error before?
Maybe some elementary error in programming?
proud to be now also part of this forum.
And of course I have an issue I don`t know how to solve :/
I want to use the YIN frequency detection “notefreq” for my project.
The problem is that “notefreq” spits out a noise frequency of 83Hz (at CPU speed 48Mhz) even if it`s completely silence.
But let`s recapitulate...
My equipment:
Hardware
Teensy 3.2
Audioboard
Microphone
Software:
arduino-1.6.11-windows.exe
TeensyduinoInstall_1.30.exe
Firstly I have test “notefreq” algorithm which a lot of recordings. I transformed my wav files with wav2sketch and include it to the example NoteFrequency:
File > Examples > Audio > Analysis > NoteFrequency
It works fine.
Next step was to test the mic... video tutorial and documentation helped me:
https://www.youtube.com/watch?v=wqt55OAabVs
See Part 2-4: Using the Microphone
https://github.com/PaulStoffregen/AudioWorkshop2015/raw/master/workshop.pdf
Code:
// Advanced Microcontroller-based Audio Workshop
//
// https://github.com/PaulStoffregen/AudioWorkshop2015/raw/master/workshop.pdf
// https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015
//
// Part 2-4: Using The Microphone
///////////////////////////////////
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s2; //xy=64,105
AudioOutputI2S i2s3; //xy=301,212
AudioConnection patchCord1(i2s2, 0, i2s3, 0);
AudioConnection patchCord2(i2s2, 0, i2s3, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=203,275
// GUItool: end automatically generated code
///////////////////////////////////
void setup() {
Serial.begin(9600);
AudioMemory(8);
sgtl5000_1.enable();
sgtl5000_1.volume(0.6);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
sgtl5000_1.micGain(30);
delay(1000);
}
void loop() {
// do nothing
}
Next step:
Design of note frequency detection via mic.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=246,135
AudioAnalyzeNoteFrequency notefreq1; //xy=623,182
AudioConnection patchCord1(i2s1, 0, notefreq1, 0);
// GUItool: end automatically generated code
void setup() {
AudioMemory(30);
/*
* Initialize the yin algorithm's absolute
* threshold, this is good number.
*/
notefreq1.begin(.15);
// pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// read back fundamental frequency
if (notefreq1.available()) {
float note = notefreq1.read();
float prob = notefreq1.probability();
Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob);
}
}
To understand the problem better I connect also the output (to stereo) to hear what happens.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=352,135
AudioAnalyzeNoteFrequency notefreq1; //xy=600,228
AudioOutputI2S i2s2; //xy=626,144
AudioConnection patchCord1(i2s1, 0, notefreq1, 0);
AudioConnection patchCord2(i2s1, 0, i2s2, 0);
AudioConnection patchCord3(i2s1, 0, i2s2, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=525,305
// GUItool: end automatically generated code
//---------------------------------------------------------------------------------------
void setup() {
AudioMemory(30);
Serial.begin(9600);
sgtl5000_1.enable();
sgtl5000_1.volume(0.6);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
sgtl5000_1.micGain(30);
delay(1000);
/*
* Initialize the yin algorithm's absolute
* threshold, this is good number.
*/
notefreq1.begin(.15);
//pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// read back fundamental frequency
if (notefreq1.available()) {
float note = notefreq1.read();
float prob = notefreq1.probability();
Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob);
}
}
Has anyone else got this error before?
Maybe some elementary error in programming?