Pārlūkot izejas kodu

Rename AudioAnalyzeGuitarTuner to AudioAnalyzeNoteFrequency

dds
PaulStoffregen pirms 9 gadiem
vecāks
revīzija
7e017b129e
22 mainītis faili ar 39 papildinājumiem un 28 dzēšanām
  1. +1
    -1
      Audio.h
  2. +10
    -10
      analyze_notefreq.cpp
  3. +5
    -5
      analyze_notefreq.h
  4. +14
    -6
      examples/Analysis/NoteFrequency/NoteFrequency.ino
  5. +0
    -0
      examples/Analysis/NoteFrequency/a2_note.cpp
  6. +0
    -0
      examples/Analysis/NoteFrequency/a2_note.h
  7. +0
    -0
      examples/Analysis/NoteFrequency/b3_note.cpp
  8. +0
    -0
      examples/Analysis/NoteFrequency/b3_note.h
  9. +0
    -0
      examples/Analysis/NoteFrequency/d3_note.cpp
  10. +0
    -0
      examples/Analysis/NoteFrequency/d3_note.h
  11. +0
    -0
      examples/Analysis/NoteFrequency/e2_note.cpp
  12. +0
    -0
      examples/Analysis/NoteFrequency/e2_note.h
  13. +0
    -0
      examples/Analysis/NoteFrequency/e4_note.cpp
  14. +0
    -0
      examples/Analysis/NoteFrequency/e4_note.h
  15. +0
    -0
      examples/Analysis/NoteFrequency/g3_note.cpp
  16. +0
    -0
      examples/Analysis/NoteFrequency/g3_note.h
  17. +0
    -0
      extras/wav2sketch/wav2sketch.exe
  18. +0
    -0
      gui/font-awesome/fonts/fontawesome-webfont.eot
  19. +0
    -0
      gui/font-awesome/fonts/fontawesome-webfont.svg
  20. +0
    -0
      gui/font-awesome/fonts/fontawesome-webfont.ttf
  21. +0
    -0
      gui/font-awesome/fonts/fontawesome-webfont.woff
  22. +9
    -6
      gui/index.html

+ 1
- 1
Audio.h Parādīt failu

@@ -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"

analyze_guitartuner.cpp → analyze_notefreq.cpp Parādīt failu

@@ -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( );

analyze_guitartuner.h → analyze_notefreq.h Parādīt failu

@@ -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) {
}

examples/Analysis/GuitarTuneNotes/GuitarTuneNotes.ino → examples/Analysis/NoteFrequency/NoteFrequency.ino Parādīt failu

@@ -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);
}
}

examples/Analysis/GuitarTuneNotes/a2_note.cpp → examples/Analysis/NoteFrequency/a2_note.cpp Parādīt failu


examples/Analysis/GuitarTuneNotes/a2_note.h → examples/Analysis/NoteFrequency/a2_note.h Parādīt failu


examples/Analysis/GuitarTuneNotes/b3_note.cpp → examples/Analysis/NoteFrequency/b3_note.cpp Parādīt failu


examples/Analysis/GuitarTuneNotes/b3_note.h → examples/Analysis/NoteFrequency/b3_note.h Parādīt failu


examples/Analysis/GuitarTuneNotes/d3_note.cpp → examples/Analysis/NoteFrequency/d3_note.cpp Parādīt failu


examples/Analysis/GuitarTuneNotes/d3_note.h → examples/Analysis/NoteFrequency/d3_note.h Parādīt failu


examples/Analysis/GuitarTuneNotes/e2_note.cpp → examples/Analysis/NoteFrequency/e2_note.cpp Parādīt failu


examples/Analysis/GuitarTuneNotes/e2_note.h → examples/Analysis/NoteFrequency/e2_note.h Parādīt failu


examples/Analysis/GuitarTuneNotes/e4_note.cpp → examples/Analysis/NoteFrequency/e4_note.cpp Parādīt failu


examples/Analysis/GuitarTuneNotes/e4_note.h → examples/Analysis/NoteFrequency/e4_note.h Parādīt failu


examples/Analysis/GuitarTuneNotes/g3_note.cpp → examples/Analysis/NoteFrequency/g3_note.cpp Parādīt failu


examples/Analysis/GuitarTuneNotes/g3_note.h → examples/Analysis/NoteFrequency/g3_note.h Parādīt failu


+ 0
- 0
extras/wav2sketch/wav2sketch.exe Parādīt failu


+ 0
- 0
gui/font-awesome/fonts/fontawesome-webfont.eot Parādīt failu


+ 0
- 0
gui/font-awesome/fonts/fontawesome-webfont.svg Parādīt failu


+ 0
- 0
gui/font-awesome/fonts/fontawesome-webfont.ttf Parādīt failu


+ 0
- 0
gui/font-awesome/fonts/fontawesome-webfont.woff Parādīt failu


+ 9
- 6
gui/index.html Parādīt failu

@@ -381,7 +381,7 @@ span.mainfunction {color: #993300; font-weight: bolder}
{"type":"AudioAnalyzeFFT256","data":{"defaults":{"name":{"value":"new"}},"shortName":"fft256","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioAnalyzeFFT1024","data":{"defaults":{"name":{"value":"new"}},"shortName":"fft1024","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioAnalyzeToneDetect","data":{"defaults":{"name":{"value":"new"}},"shortName":"tone","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioAnalyzeGuitarTuner","data":{"defaults":{"name":{"value":"new"}},"shortName":"guitartuner","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioAnalyzeNoteFrequency","data":{"defaults":{"name":{"value":"new"}},"shortName":"notefreq","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioAnalyzePrint","data":{"defaults":{"name":{"value":"new"}},"shortName":"print","inputs":1,"outputs":0,"category":"analyze-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioControlSGTL5000","data":{"defaults":{"name":{"value":"new"}},"shortName":"sgtl5000","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
{"type":"AudioControlWM8731","data":{"defaults":{"name":{"value":"new"}},"shortName":"wm8731","inputs":0,"outputs":0,"category":"control-function","color":"#E6E0F8","icon":"arrow-in.png"}},
@@ -2286,10 +2286,10 @@ double s_freq = .0625;</p>
</div>
</script>

<script type="text/x-red" data-help-name="AudioAnalyzeGuitarTuner">
<script type="text/x-red" data-help-name="AudioAnalyzeNoteFrequency">
<h3>Summary</h3>
<p>Detect with fairly good accuracy the fundamental frequencies f<sub>o</sub> from
electric guitars and basses.</p>
<p>Detect with fairly good accuracy the fundamental frequency f<sub>o</sub>
of musical notes, such as electric guitar and bass.</p>
<p>Written By Collin Duffy</p>
<h3>Audio Connections</h3>
<table class=doc align=center cellpadding=3>
@@ -2315,7 +2315,7 @@ double s_freq = .0625;</p>
<p class=desc>Set the detection threshold, the amount of allowed uncertainty.
</p>
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; GuitarTuneNotes
<p class=exam>File &gt; Examples &gt; Audio &gt; Analysis &gt; NoteFrequency
</p>
<h3>Notes</h3>
<p>The <a href="http://recherche.ircam.fr/equipes/pcm/cheveign/pss/2002_JASA_YIN.pdf">YIN algorithm</a> (PDF)
@@ -2327,11 +2327,14 @@ double s_freq = .0625;</p>
<p>Within the code, AUDIO_GUITARTUNER_BLOCKS
may be edited to control low frequency range. The default
(24) allows measurement down to 29.14 Hz, or B(flat)0.</p>
<p>TODO: The usable upper range of this object is not well known.
Duff says "it should be good up to 1000Hz", but may have trouble
at 4 kHz. Please <a href="https://forum.pjrc.com/threads/32252-Different-Range-FFT-Algorithm/page2">post feedback here</a>, ideally with audio clips for the NoteFrequency example.</p>
<p>This object was contributed by Collin Duffy from his
<a href="https://github.com/duff2013/AudioTuner">AudioTuner project</a>.
Additional details and documentation may be found there.</p>
</script>
<script type="text/x-red" data-template-name="AudioAnalyzeGuitarTuner">
<script type="text/x-red" data-template-name="AudioAnalyzeNoteFrequency">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">

Notiek ielāde…
Atcelt
Saglabāt