You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
пре 9 година
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <p align="center">
  2. <b>Guitar and Bass Tuner Library v2.2</b><br>
  3. <b>Teensy 3.1/2</b><br>
  4. </p>
  5. >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 f<sub>o</sub> from electric guitars and basses.
  6. >>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.
  7. <!-- language: lang-none -->
  8. Hookup Guide - 1.2v DC Bias and High Pass Filter - No Amplification
  9. *--------------------------------------------------*
  10. | |
  11. | Pull Down Resistor | ' | |
  12. *------------/\/\/\-------------* |' '| |
  13. | 47K | _|_'_|_ |
  14. | | |` ` ` `| |
  15. *---)|+---* | | ` ` ` | |
  16. | 10uF | | |` ` ` `| |
  17. TEENSY 3.1 | | | | ` ` ` | |
  18. _______________ *-/\/\/\--* | |` ` ` `| |
  19. |GND |_____| Vin| | 2.2K | | | ` ` ` | |
  20. |0 ----- AGND|<-* | | |` ` ` `| |
  21. |1 |`````| 3.3V|>---/\/\/\--*--/\/\/\--* | | ` ` ` | |
  22. |2 | | 23| 10K 47K | | |` ` ` `| |
  23. |3 ----- 22| | | | ` ` ` | |
  24. |4 |'| 21| | | \=====/ |
  25. |5 ------ 20| | | | '`| |
  26. |6 |::::::::| 19| | REMOVE | | S`| |
  27. |7 |::::::::| 18| | DC | | H`| |
  28. |8 |::::::::| 17| | BIAS | | I`| |
  29. |9 ------A2/16|<---SIGNAL-1.2v-BIAS---*---+|(----* | E`|>--ANGD--*
  30. |10 --- 15| 1.2VDC 10uF | | L`|
  31. |11 |(`)| 14| | | D`|
  32. |12 --- 13| | | `|
  33. --------------- | |===|
  34. | \_/
  35. | /T\
  36. | .-I-.
  37. *---<\ P /
  38. \_/
  39. >Many optimizations have been done to the [YIN] algorithm for frequencies between 29-360Hz.
  40. >>While its still using a brute force method ( n<sup>2</sup> ) for finding the fundamental frequency f<sub>o</sub>, it is tuned to skip certain <b>tau</b> (<img src="http://latex.numberempire.com/render?%5Cinline%20%5Chuge%20%5Cmathbf%7B%5Ctau%7D&sig=845639da85c0dd8e2de679817b06639c"/></img>) values and focus mostly on frequencies found in the bass and guitar.
  41. >>>The input is double buffered so while you are processing one buffer it is filling the other to double throughput.
  42. >>>>There are a few parameters that can be adjusted to "dial in" the algorithm for better estimations located in AudioTuner.h. The defaults below are what I found that have the best trade off for speed and accuracy.
  43. <h4>AudioTuner.h</h4>
  44. ```
  45. /****************************************************************/
  46. #define SAMPLE_RATE_44100 1 // 44100 sample rate
  47. #define SAMPLE_RATE_22050 2 // 22050 sample rate
  48. #define SAMPLE_RATE_11025 4 // 11025 sample rate
  49. /****************************************************************/
  50. /****************************************************************
  51. * Safe to adjust these values below *
  52. * *
  53. * These two parameters define how this object works. *
  54. * *
  55. * 1. NUM_SAMPLES - Size of the buffer. Since object uses *
  56. * double buffering this value will be 4x in bytes of *
  57. * memory. !!! Must be power of 2 !!!! *
  58. * *
  59. * 2. SAMPLE_RATE - Just what it says. *
  60. * *
  61. * These two parameters work hand in hand. For example if you *
  62. * want a high sample rate but do not allocate enough buffer *
  63. * space, you will be limit how low of a frequency you can *
  64. * measure. If you then increase the buffer you use up *
  65. * precious ram and slow down the system since it takes longer *
  66. * to processes the buffer. *
  67. * *
  68. * Play around with these values to find what best suits your *
  69. * needs. The max number of buffers you can have is 8192 bins. *
  70. ****************************************************************/
  71. // !!! Must be power of 2 !!!!
  72. #define NUM_SAMPLES 2048 // make a power of two
  73. // Use defined sample rates above^
  74. #define SAMPLE_RATE SAMPLE_RATE_22050
  75. /****************************************************************/
  76. ```
  77. <div>
  78. <b>YIN Algorithm</b>
  79. <ol>
  80. <li><b>Difference Function -</b> Squared difference of the (signal - signal lag(<img src="http://latex.numberempire.com/render?%5Cinline%20%5Chuge%20%5Cmathbf%7B%5Ctau%7D&sig=845639da85c0dd8e2de679817b06639c"/></img>))<br>
  81. <img src="http://latex.numberempire.com/render?%5Chuge%20d_%7Bt%7D%20%5Cbig%28%20%5Ctau%20%5Cbig%29%20%3D%20%5Csum_%7Bj%3D1%7D%5EW%20%20%5Cbig%28x_%7Bj%7D-x_%7Bj%2B%5Ctau%7D%5Cbig%29%5E%7B2%7D&sig=da6a2a10a134437679df399dbb9327df" /></li>
  82. <li><b>Cumulative Mean Normalized Difference Function -</b> Calculate the cumulative mean on the normalized difference signal<br><img src="http://latex.numberempire.com/render?%5Cinline%20%5Chuge%20d%27_%7Bt%7D%20%5Cbig%28%20%5Ctau%20%5Cbig%29%20%3D%5Cbegin%7Bcases%7D1%2C%20%26%20%5Ctau%20%3D%200%5C%5Cd_%7Bt%7D%20%5Cbig%28%20%5Ctau%20%5Cbig%29%5Cdiagup%20%26%5Cleft%5B%28%5Cfrac%7B1%7D%7B%5Ctau%7D%29%5Csum_%7Bj%3D1%7D%5E%5Ctau%20%20d_%7Bt%7D%20%28j%29%5Cright%5D%5Cend%7Bcases%7D&sig=15a0b31a37bd5db3074f854711119bb3" /></li>
  83. <li><b>Absolute Threshold -</b> Fix for subharmonic error with Autocorrelation, choose (<img src="http://latex.numberempire.com/render?%5Cinline%20%5Chuge%20%5Cmathbf%7B%5Ctau%7D&sig=845639da85c0dd8e2de679817b06639c"/></img>) that gives a minimum <img src="http://latex.numberempire.com/render?%5Chuge%20d%27&sig=ec41ac0239b48a3c53617da8e4ca64c7"/></li>
  84. </ol>
  85. </div>
  86. [YIN]:http://recherche.ircam.fr/equipes/pcm/cheveign/pss/2002_JASA_YIN.pdf