A program to automatically tune a guitar. Written by Justin Reidhead and Steven Swenson
Dependencies: FFT FrequencyFinder Motor NewTextLCD PinDetect mbed strings
FrequencyFinder/FrequencyFinder.h@14:fd59e7acf2e5, 2012-04-26 (annotated)
- Committer:
- melangeaddict
- Date:
- Thu Apr 26 22:20:53 2012 +0000
- Revision:
- 14:fd59e7acf2e5
- Parent:
- 10:4566e8aeb3ae
98% Completed; Good step numbers up and down;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
melangeaddict | 2:9c0a83c5ded5 | 1 | #pragma once |
melangeaddict | 2:9c0a83c5ded5 | 2 | #include "mbed.h" |
melangeaddict | 2:9c0a83c5ded5 | 3 | #include "FFT.h" |
melangeaddict | 2:9c0a83c5ded5 | 4 | |
melangeaddict | 2:9c0a83c5ded5 | 5 | #include "NewTextLCD.h" |
melangeaddict | 2:9c0a83c5ded5 | 6 | |
melangeaddict | 2:9c0a83c5ded5 | 7 | using namespace std; |
melangeaddict | 2:9c0a83c5ded5 | 8 | |
melangeaddict | 2:9c0a83c5ded5 | 9 | const int size=4096; |
melangeaddict | 2:9c0a83c5ded5 | 10 | |
melangeaddict | 2:9c0a83c5ded5 | 11 | class FrequencyFinder{ |
melangeaddict | 2:9c0a83c5ded5 | 12 | public: |
melangeaddict | 2:9c0a83c5ded5 | 13 | |
melangeaddict | 2:9c0a83c5ded5 | 14 | FrequencyFinder(PinName input); |
melangeaddict | 2:9c0a83c5ded5 | 15 | ~FrequencyFinder(); |
melangeaddict | 2:9c0a83c5ded5 | 16 | |
melangeaddict | 2:9c0a83c5ded5 | 17 | float find_frequency(); |
melangeaddict | 2:9c0a83c5ded5 | 18 | void get_data(); |
melangeaddict | 2:9c0a83c5ded5 | 19 | void take_abs(); |
melangeaddict | 2:9c0a83c5ded5 | 20 | int find_peak(); |
melangeaddict | 2:9c0a83c5ded5 | 21 | int find_max(int); |
melangeaddict | 2:9c0a83c5ded5 | 22 | void initialize_array(); |
melangeaddict | 9:2a211133e79a | 23 | void copy_data(); |
melangeaddict | 2:9c0a83c5ded5 | 24 | |
melangeaddict | 2:9c0a83c5ded5 | 25 | private: |
melangeaddict | 2:9c0a83c5ded5 | 26 | float signal_array[size]; |
melangeaddict | 2:9c0a83c5ded5 | 27 | int index; |
melangeaddict | 2:9c0a83c5ded5 | 28 | int peak; |
melangeaddict | 2:9c0a83c5ded5 | 29 | int frequency_final; |
melangeaddict | 2:9c0a83c5ded5 | 30 | |
melangeaddict | 2:9c0a83c5ded5 | 31 | Ticker ticker; |
melangeaddict | 2:9c0a83c5ded5 | 32 | AnalogIn _signal_in; |
melangeaddict | 2:9c0a83c5ded5 | 33 | AnalogOut _dc_offset; |
melangeaddict | 10:4566e8aeb3ae | 34 | |
melangeaddict | 2:9c0a83c5ded5 | 35 | }; |