duff2013 290c3a77b4 Merge pull request #2 from logsol/patch-1 | pirms 5 gadiem | |
---|---|---|
examples | pirms 7 gadiem | |
AudioTuner.cpp | pirms 6 gadiem | |
AudioTuner.h | pirms 6 gadiem | |
README.md | pirms 6 gadiem | |
keywords.txt | pirms 9 gadiem | |
library.properties | pirms 6 gadiem | |
license.md | pirms 5 gadiem | |
revision.md | pirms 6 gadiem |
Guitar and Bass Tuner Library v3.3
Teensy 3.1/2
Software algorithm (YIN) for guitar and bass tuning using a Teensy Audio Library. This audio object’s algorithm can be some what memory and processor hungry but will allow you to detect with fairly good accuracy the fundamental frequencies fo from electric guitars and basses.
You can install this as a normal Arduino Library and will work with the Audio Library, no need to edit the Audio libraries source now.
Hookup Guide - ~.6v DC Bias and High Pass Filter - No Amplification
*--------------------------------------------------*
| |
| Pull Down Resistor | ' | |
*------------/\/\/\-------------* |' '| |
| 47K | _|_'_|_ |
| | |` ` ` `| |
*---)|+---* | | ` ` ` | |
| 10uF | | |` ` ` `| |
TEENSY 3.1 | | | | ` ` ` | |
_______________ *-/\/\/\--* | |` ` ` `| |
|GND |_____| Vin| | 2.2K | | | ` ` ` | |
|0 ----- AGND|<-* | | |` ` ` `| |
|1 |`````| 3.3V|>---/\/\/\--*--/\/\/\--* | | ` ` ` | |
|2 | | 23| 10K 47K | | |` ` ` `| |
|3 ----- 22| | | | ` ` ` | |
|4 |'| 21| | | \=====/ |
|5 ------ 20| | | | '`| |
|6 |::::::::| 19| | REMOVE | | S`| |
|7 |::::::::| 18| | DC | | H`| |
|8 |::::::::| 17| | BIAS | | I`| |
|9 ------A2/16|<---SIGNAL-.6v-BIAS----*---+|(----* | E`|>--ANGD--*
|10 --- 15| .6VDC 10uF | | L`|
|11 |(`)| 14| | | D`|
|12 --- 13| | | `|
--------------- | |===|
| \_/
| /T\
| .-I-.
*---<\ P /
\_/
Many optimizations have been done to the YIN algorithm for frequencies between 29-400Hz.
While its still using a brute force method ( n2 ) for finding the fundamental frequency fo, it is tuned to skip certain tau () values and focus mostly on frequencies found in the bass and guitar.
The input is double buffered so while you are processing one buffer it is filling the other to double throughput.
The parameter AUDIO_BLOCKS below can be adjusted but its default of 24 I found to be best to work with the guitar and bass frequency range (29- 400)Hz.
Looking into finding the Auto Correlation using FFT and IFFT to speed up processing of data! Not that simple because the YIN algorithm uses a squared difference tweak to the Auto Correlation.
/***********************************************************************
* Safe to adjust these values below *
* *
* This parameter defines the size of the buffer. *
* *
* 1. AUDIO_GUITARTUNER_BLOCKS - Buffer size is 128 * AUDIO_BLOCKS. *
* The more AUDIO_GUITARTUNER_BLOCKS the lower *
* the frequency you can detect. The default *
* (24) is set to measure down to 29.14 Hz *
* or B(flat)0. *
* *
* 2. MAX_COEFF - Maxium number of coefficeints for the FIR filter. *
* *
***********************************************************************/
#define AUDIO_GUITARTUNER_BLOCKS 24
#define MAX_COEFF 200
/***********************************************************************/