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@2:9c0a83c5ded5, 2012-04-15 (annotated)
- Committer:
- melangeaddict
- Date:
- Sun Apr 15 00:37:37 2012 +0000
- Revision:
- 2:9c0a83c5ded5
- Child:
- 9:2a211133e79a
Uncommented mbed parts
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 | 2:9c0a83c5ded5 | 23 | |
melangeaddict | 2:9c0a83c5ded5 | 24 | private: |
melangeaddict | 2:9c0a83c5ded5 | 25 | float signal_array[size]; |
melangeaddict | 2:9c0a83c5ded5 | 26 | int index; |
melangeaddict | 2:9c0a83c5ded5 | 27 | int peak; |
melangeaddict | 2:9c0a83c5ded5 | 28 | int frequency_final; |
melangeaddict | 2:9c0a83c5ded5 | 29 | |
melangeaddict | 2:9c0a83c5ded5 | 30 | Ticker ticker; |
melangeaddict | 2:9c0a83c5ded5 | 31 | AnalogIn _signal_in; |
melangeaddict | 2:9c0a83c5ded5 | 32 | AnalogOut _dc_offset; |
melangeaddict | 2:9c0a83c5ded5 | 33 | }; |