diff --git a/Audio.h b/Audio.h index b502836b..9f669dd1 100644 --- a/Audio.h +++ b/Audio.h @@ -62,7 +62,7 @@ #include "analyze_fft1024.h" #include "analyze_print.h" #include "analyze_tonedetect.h" -#include "analyze_guitartuner.h" +#include "analyze_notefreq.h" #include "analyze_peak.h" #include "control_sgtl5000.h" #include "control_wm8731.h" diff --git a/analyze_guitartuner.cpp b/analyze_notefreq.cpp similarity index 93% rename from analyze_guitartuner.cpp rename to analyze_notefreq.cpp index 6a4a4afe..2afe86ee 100644 --- a/analyze_guitartuner.cpp +++ b/analyze_notefreq.cpp @@ -1,4 +1,4 @@ -/* Audio Library Guitar and Bass Tuner +/* Audio Library Note Frequency Detection & Guitar/Bass Tuner * Copyright (c) 2015, Colin Duffy * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -20,7 +20,7 @@ * THE SOFTWARE. */ -#include "analyze_guitartuner.h" +#include "analyze_notefreq.h" #include "utility/dspinst.h" #include "arm_math.h" @@ -42,7 +42,7 @@ static void copy_buffer(void *destination, const void *source) { for (int i=0; i < AUDIO_BLOCK_SAMPLES; i++) *dst++ = *src++; } -void AudioAnalyzeGuitarTuner::update( void ) { +void AudioAnalyzeNoteFrequency::update( void ) { audio_block_t *block; @@ -80,7 +80,7 @@ void AudioAnalyzeGuitarTuner::update( void ) { } } -FASTRUN void AudioAnalyzeGuitarTuner::process( void ) { +FASTRUN void AudioAnalyzeNoteFrequency::process( void ) { //digitalWriteFast(0, HIGH); const int16_t *p; @@ -164,7 +164,7 @@ FASTRUN void AudioAnalyzeGuitarTuner::process( void ) { * * @return tau */ -uint16_t AudioAnalyzeGuitarTuner::estimate( int64_t *yin, int64_t *rs, uint16_t head, uint16_t tau ) { +uint16_t AudioAnalyzeNoteFrequency::estimate( int64_t *yin, int64_t *rs, uint16_t head, uint16_t tau ) { const int64_t *y = ( int64_t * )yin; const int64_t *r = ( int64_t * )rs; uint16_t _tau, _head; @@ -202,7 +202,7 @@ uint16_t AudioAnalyzeGuitarTuner::estimate( int64_t *yin, int64_t *rs, uint16_t * @param threshold Allowed uncertainty * @param cpu_max How much cpu usage before throttling */ -void AudioAnalyzeGuitarTuner::begin( float threshold ) { +void AudioAnalyzeNoteFrequency::begin( float threshold ) { __disable_irq( ); process_buffer = false; yin_threshold = threshold; @@ -223,7 +223,7 @@ void AudioAnalyzeGuitarTuner::begin( float threshold ) { * * @return true if data is ready else false */ -bool AudioAnalyzeGuitarTuner::available( void ) { +bool AudioAnalyzeNoteFrequency::available( void ) { __disable_irq( ); bool flag = new_output; if ( flag ) new_output = false; @@ -236,7 +236,7 @@ bool AudioAnalyzeGuitarTuner::available( void ) { * * @return frequency in hertz */ -float AudioAnalyzeGuitarTuner::read( void ) { +float AudioAnalyzeNoteFrequency::read( void ) { __disable_irq( ); float d = data; __enable_irq( ); @@ -248,7 +248,7 @@ float AudioAnalyzeGuitarTuner::read( void ) { * * @return periodicity */ -float AudioAnalyzeGuitarTuner::probability( void ) { +float AudioAnalyzeNoteFrequency::probability( void ) { __disable_irq( ); float p = periodicity; __enable_irq( ); @@ -260,7 +260,7 @@ float AudioAnalyzeGuitarTuner::probability( void ) { * * @param thresh Allowed uncertainty */ -void AudioAnalyzeGuitarTuner::threshold( float p ) { +void AudioAnalyzeNoteFrequency::threshold( float p ) { __disable_irq( ); yin_threshold = p; __enable_irq( ); diff --git a/analyze_guitartuner.h b/analyze_notefreq.h similarity index 93% rename from analyze_guitartuner.h rename to analyze_notefreq.h index 3f8b159f..49f3d3cf 100644 --- a/analyze_guitartuner.h +++ b/analyze_notefreq.h @@ -1,4 +1,4 @@ -/* Audio Library Guitar and Bass Tuner +/* Audio Library Note Frequency Detection & Guitar/Bass Tuner * Copyright (c) 2015, Colin Duffy * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -20,8 +20,8 @@ * THE SOFTWARE. */ -#ifndef AudioAnalyzeGuitarTuner_h_ -#define AudioAnalyzeGuitarTuner_h_ +#ifndef AudioAnalyzeNoteFrequency_h_ +#define AudioAnalyzeNoteFrequency_h_ #include "AudioStream.h" /*********************************************************************** @@ -38,14 +38,14 @@ ***********************************************************************/ #define AUDIO_GUITARTUNER_BLOCKS 24 /***********************************************************************/ -class AudioAnalyzeGuitarTuner : public AudioStream { +class AudioAnalyzeNoteFrequency : public AudioStream { public: /** * constructor to setup Audio Library and initialize * * @return none */ - AudioAnalyzeGuitarTuner( void ) : AudioStream( 1, inputQueueArray ), enabled( false ), new_output(false) { + AudioAnalyzeNoteFrequency( void ) : AudioStream( 1, inputQueueArray ), enabled( false ), new_output(false) { } diff --git a/examples/Analysis/GuitarTuneNotes/GuitarTuneNotes.ino b/examples/Analysis/NoteFrequency/NoteFrequency.ino similarity index 83% rename from examples/Analysis/GuitarTuneNotes/GuitarTuneNotes.ino rename to examples/Analysis/NoteFrequency/NoteFrequency.ino index 1dc5e1b9..a82f83d1 100644 --- a/examples/Analysis/GuitarTuneNotes/GuitarTuneNotes.ino +++ b/examples/Analysis/NoteFrequency/NoteFrequency.ino @@ -1,3 +1,11 @@ +/* Detect the frequency of music notes, by Colin Duffy + + This example repeatedly plays a guitar note (output to the DAC pin) + and prints an analysis of the frequency to the Arduino Serial Monitor + + https://forum.pjrc.com/threads/32252-Different-Range-FFT-Algorithm/page2 + https://github.com/duff2013/AudioTuner +*/ /* C C# D Eb E F F# G G# A Bb B 0 16.35 17.32 18.35 19.45 20.60 21.83 23.12 24.50 25.96 27.50 29.14 30.87 @@ -32,13 +40,13 @@ #include "b3_note.h" #include "e4_note.h" //--------------------------------------------------------------------------------------- -AudioAnalyzeGuitarTuner tuner; +AudioAnalyzeNoteFrequency notefreq; AudioOutputAnalog dac; AudioPlayMemory wav_note; AudioMixer4 mixer; //--------------------------------------------------------------------------------------- AudioConnection patchCord0(wav_note, 0, mixer, 0); -AudioConnection patchCord1(mixer, 0, tuner, 0); +AudioConnection patchCord1(mixer, 0, notefreq, 0); AudioConnection patchCord2(mixer, 0, dac, 0); //--------------------------------------------------------------------------------------- IntervalTimer playNoteTimer; @@ -61,16 +69,16 @@ void setup() { * Initialize the yin algorithm's absolute * threshold, this is good number. */ - tuner.begin(.15); + notefreq.begin(.15); pinMode(LED_BUILTIN, OUTPUT); playNoteTimer.begin(playNote, 1000); } void loop() { // read back fundamental frequency - if (tuner.available()) { - float note = tuner.read(); - float prob = tuner.probability(); + if (notefreq.available()) { + float note = notefreq.read(); + float prob = notefreq.probability(); Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob); } } diff --git a/examples/Analysis/GuitarTuneNotes/a2_note.cpp b/examples/Analysis/NoteFrequency/a2_note.cpp similarity index 100% rename from examples/Analysis/GuitarTuneNotes/a2_note.cpp rename to examples/Analysis/NoteFrequency/a2_note.cpp diff --git a/examples/Analysis/GuitarTuneNotes/a2_note.h b/examples/Analysis/NoteFrequency/a2_note.h similarity index 100% rename from examples/Analysis/GuitarTuneNotes/a2_note.h rename to examples/Analysis/NoteFrequency/a2_note.h diff --git a/examples/Analysis/GuitarTuneNotes/b3_note.cpp b/examples/Analysis/NoteFrequency/b3_note.cpp similarity index 100% rename from examples/Analysis/GuitarTuneNotes/b3_note.cpp rename to examples/Analysis/NoteFrequency/b3_note.cpp diff --git a/examples/Analysis/GuitarTuneNotes/b3_note.h b/examples/Analysis/NoteFrequency/b3_note.h similarity index 100% rename from examples/Analysis/GuitarTuneNotes/b3_note.h rename to examples/Analysis/NoteFrequency/b3_note.h diff --git a/examples/Analysis/GuitarTuneNotes/d3_note.cpp b/examples/Analysis/NoteFrequency/d3_note.cpp similarity index 100% rename from examples/Analysis/GuitarTuneNotes/d3_note.cpp rename to examples/Analysis/NoteFrequency/d3_note.cpp diff --git a/examples/Analysis/GuitarTuneNotes/d3_note.h b/examples/Analysis/NoteFrequency/d3_note.h similarity index 100% rename from examples/Analysis/GuitarTuneNotes/d3_note.h rename to examples/Analysis/NoteFrequency/d3_note.h diff --git a/examples/Analysis/GuitarTuneNotes/e2_note.cpp b/examples/Analysis/NoteFrequency/e2_note.cpp similarity index 100% rename from examples/Analysis/GuitarTuneNotes/e2_note.cpp rename to examples/Analysis/NoteFrequency/e2_note.cpp diff --git a/examples/Analysis/GuitarTuneNotes/e2_note.h b/examples/Analysis/NoteFrequency/e2_note.h similarity index 100% rename from examples/Analysis/GuitarTuneNotes/e2_note.h rename to examples/Analysis/NoteFrequency/e2_note.h diff --git a/examples/Analysis/GuitarTuneNotes/e4_note.cpp b/examples/Analysis/NoteFrequency/e4_note.cpp similarity index 100% rename from examples/Analysis/GuitarTuneNotes/e4_note.cpp rename to examples/Analysis/NoteFrequency/e4_note.cpp diff --git a/examples/Analysis/GuitarTuneNotes/e4_note.h b/examples/Analysis/NoteFrequency/e4_note.h similarity index 100% rename from examples/Analysis/GuitarTuneNotes/e4_note.h rename to examples/Analysis/NoteFrequency/e4_note.h diff --git a/examples/Analysis/GuitarTuneNotes/g3_note.cpp b/examples/Analysis/NoteFrequency/g3_note.cpp similarity index 100% rename from examples/Analysis/GuitarTuneNotes/g3_note.cpp rename to examples/Analysis/NoteFrequency/g3_note.cpp diff --git a/examples/Analysis/GuitarTuneNotes/g3_note.h b/examples/Analysis/NoteFrequency/g3_note.h similarity index 100% rename from examples/Analysis/GuitarTuneNotes/g3_note.h rename to examples/Analysis/NoteFrequency/g3_note.h diff --git a/extras/wav2sketch/wav2sketch.exe b/extras/wav2sketch/wav2sketch.exe old mode 100755 new mode 100644 diff --git a/gui/font-awesome/fonts/fontawesome-webfont.eot b/gui/font-awesome/fonts/fontawesome-webfont.eot old mode 100755 new mode 100644 diff --git a/gui/font-awesome/fonts/fontawesome-webfont.svg b/gui/font-awesome/fonts/fontawesome-webfont.svg old mode 100755 new mode 100644 diff --git a/gui/font-awesome/fonts/fontawesome-webfont.ttf b/gui/font-awesome/fonts/fontawesome-webfont.ttf old mode 100755 new mode 100644 diff --git a/gui/font-awesome/fonts/fontawesome-webfont.woff b/gui/font-awesome/fonts/fontawesome-webfont.woff old mode 100755 new mode 100644 diff --git a/gui/index.html b/gui/index.html index 2bd55537..50f32ee7 100644 --- a/gui/index.html +++ b/gui/index.html @@ -381,7 +381,7 @@
Keyboard Shortcuts Notes
- -