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.

README.md 4.9KB

9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
9 년 전
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #Guitar and Bass Tuner Library
  2. #Teensy 3.1 v2.0
  3. >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 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.
  4. >Many optimizations have been done to the [YIN] algorithm for frequencies between 29-360Hz. While its still using a brute force method ( n<sup>2</sup> ) for finding fundamental frequency f(o) it is tuned to skip <b>tau</b> values that are out of its frequency range 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 throuput. There are a few parameters that can be adjusted to "dial in" the algorithm for better estimations. The defaults are what I found that have the best trade off for speed and accuracy.
  5. <!-- language: lang-none -->
  6. Hookup Guide - 1.2v DC Bias and High Pass Filter - No Amplification
  7. *--------------------------------------------------*
  8. | |
  9. | | ' | |
  10. *------------/\/\/\-------------* |' '| |
  11. | 47K | _|_'_|_ |
  12. | | |` ` ` `| |
  13. *---)|+--* | | ` ` ` | |
  14. | 10uF | | |` ` ` `| |
  15. | | | | ` ` ` | |
  16. _______________ *-/\/\/\-* | |` ` ` `| |
  17. |GND |___| Vin| | 2.2K | | | ` ` ` | |
  18. |0 T AGND|<-* | | |` ` ` `| |
  19. |1 E 3.3V|>--/\/\/\--*--/\/\/\---* | | ` ` ` | |
  20. |2 E 23| 10K 47K | | |` ` ` `| |
  21. |3 N 22| | | | ` ` ` | |
  22. |4 S 21| | | \_`_`_/ |
  23. |5 Y 20| | | | :`| |
  24. |6 3.1 19| | | | S`| |
  25. |7 18| | REMOVE | | H`| |
  26. |8 17| | DC | | I`| |
  27. |9 A2/16|<---SIGNAL-1.2v-BIAS---*---+|(----* | E`|>--ANGD--*
  28. |10 --- 15| 1.2V 10uF | | L`|
  29. |11 |(`)| 14| DC | | D`|
  30. |12 --- 13| | | :`|
  31. --------------- | |===|
  32. | \_/
  33. | /T\
  34. | - I -
  35. *---<\ P /
  36. \_/
  37. <h4>AudioTuner.h</h4>
  38. ```
  39. /****************************************************************/
  40. #define SAMPLE_RATE_DIVIDE_BY_1 1 // 44100 sample rate
  41. #define SAMPLE_RATE_DIVIDE_BY_2 2 // 22050 sample rate
  42. #define SAMPLE_RATE_DIVIDE_BY_4 4 // 11025 sample rate
  43. #define SAMPLE_RATE_DIVIDE_BY_8 8 // 5512.5 sample rate
  44. #define SAMPLE_RATE_DIVIDE_BY_16 16 // 2756.25 sample rate
  45. #define SAMPLE_RATE_DIVIDE_BY_32 32 // 1378.125 sample rate
  46. /****************************************************************
  47. * Safe to adjust these values below *
  48. ****************************************************************/
  49. // Adjust number of samples to collect in buffer here, also effects
  50. // convergence speed and resolution.
  51. #define NUM_SAMPLES 2048 // make a power of two
  52. // larger the divide-by, less resolution and lower the frequency for
  53. // a given number of samples that can be detected. Also effects
  54. // convergence speed.
  55. #define SAMPLE_SKIP SAMPLE_RATE_DIVIDE_BY_2
  56. /****************************************************************/
  57. ```
  58. ```
  59. SAMPLE_RATE_DIVIDE_BY_x --> This sets 'SAMPLE_SKIP' to pass on every (x) data piont from the
  60. Audio Block being saved to the buffer, it determines the sample rate.
  61. ```
  62. ```
  63. NUM_SAMPLES --> This the size of each buffer, there two for double buffering.
  64. ```
  65. ```
  66. SAMPLE_SKIP --> This sets your sample window lenght and sampling rate. Sample Window Size is
  67. (NUM_SAMPLES * SAMPLE_SKIP) of the ~44100 samples every second. Sample Rate is
  68. (AUDIO_SAMPLE_RATE_EXACT / SAMPLE_SKIP).
  69. ```
  70. [YIN]:http://recherche.ircam.fr/equipes/pcm/cheveign/pss/2002_JASA_YIN.pdf