Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
duff2013 b7b3e6a8de update před 9 roky
examples update- see revision.md před 9 roky
AudioTuner.cpp update- see revision.md před 9 roky
AudioTuner.h update- see revision.md před 9 roky
README.md update před 9 roky
keywords.txt update před 9 roky
library.properties update- see revision.md před 9 roky
revision.md update- see revision.md před 9 roky

README.md

Guitar and Bass Tuner Library v2.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.

AudioTuner.h

/****************************************************************
*              Safe to adjust these values below               *
*                                                              *
*  This parameter defines the size of the buffer.              *
*                                                              *
*  1.  AUDIO_BLOCKS -  Buffer size is 128 * AUDIO_BLOCKS.      *
*                      The more AUDIO_BLOCKS the lower the     *
*                      frequency you can detect. The default   *
*                      (24) is set to measure down to 29.14    *
*                      Hz or B(flat)0.                         *
*                                                              *
****************************************************************/
#define AUDIO_BLOCKS  24
/****************************************************************/
YIN Algorithm
  1. Difference Function - Squared difference of the (signal - signal lag())
  2. Cumulative Mean Normalized Difference Function - Calculate the cumulative mean on the normalized difference signal
  3. Absolute Threshold - Fix for subharmonic error with Autocorrelation, choose () that gives a minimum