Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
John Robinson 41f7c1e7f0
initial dds package spec
3 anos atrás
examples Docs formatting fixes (#1) 5 anos atrás
include/audio restructure code into src and include dirs 3 anos atrás
src restructure code into src and include dirs 3 anos atrás
README.md update - see revision.md 6 anos atrás
keywords.txt update 9 anos atrás
library.json5 initial dds package spec 3 anos atrás
library.properties update - see revision.md 6 anos atrás
license.md Add licensing 5 anos atrás
package.json5 initial dds package spec 3 anos atrás
revision.md update - see revision.md 6 anos atrás

README.md

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.

AudioTuner.h

/***********************************************************************
 *              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
/***********************************************************************/
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