|
-
-
- #ifndef AudioAnalyzeNoteFrequency_h_
- #define AudioAnalyzeNoteFrequency_h_
-
- #include "Arduino.h"
- #include "AudioStream.h"
-
- #define AUDIO_GUITARTUNER_BLOCKS 24
-
- class AudioAnalyzeNoteFrequency : public AudioStream {
- public:
-
-
- AudioAnalyzeNoteFrequency( void ) : AudioStream( 1, inputQueueArray ), enabled( false ), new_output(false) {
-
- }
-
-
-
- void begin( float threshold );
-
-
-
- void threshold( float p );
-
-
-
- bool available( void );
-
-
- float read( void );
-
-
-
- float probability( void );
-
-
-
- virtual void update( void );
-
- private:
-
-
- uint16_t estimate( uint64_t *yin, uint64_t *rs, uint16_t head, uint16_t tau );
-
-
-
- void process( void );
-
-
-
- uint64_t running_sum;
- uint16_t tau_global;
- uint64_t yin_buffer[5];
- uint64_t rs_buffer[5];
- int16_t AudioBuffer[AUDIO_GUITARTUNER_BLOCKS*128] __attribute__ ( ( aligned ( 4 ) ) );
- uint8_t yin_idx, state;
- float periodicity, yin_threshold, cpu_usage_max, data;
- bool enabled, next_buffer, first_run;
- volatile bool new_output, process_buffer;
- audio_block_t *blocklist1[AUDIO_GUITARTUNER_BLOCKS];
- audio_block_t *blocklist2[AUDIO_GUITARTUNER_BLOCKS];
- audio_block_t *inputQueueArray[1];
- };
- #endif
|