Giter Club home page Giter Club logo

audiotuner's Introduction

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

audiotuner's People

Contributors

duff2013 avatar logsol avatar dogweather avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.