Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
John Robinson 3e531ac7db
adjust arm_math.h include per dep change
pirms 3 gadiem
examples Docs formatting fixes (#1) pirms 5 gadiem
include/audio adjust arm_math.h include per dep change pirms 3 gadiem
src adjust arm_math.h include per dep change pirms 3 gadiem
README.md update - see revision.md pirms 6 gadiem
keywords.txt update pirms 9 gadiem
library.json5 initial dds package spec pirms 3 gadiem
library.properties update - see revision.md pirms 6 gadiem
license.md Add licensing pirms 5 gadiem
package.json5 initial dds package spec pirms 3 gadiem
revision.md update - see revision.md pirms 6 gadiem

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