|
FastLED 3.10.8
|
Pitch - Continuous pitch tracking using autocorrelation.
Detects the fundamental frequency (pitch) of audio signals using autocorrelation analysis on the time-domain PCM data. This detector provides continuous pitch tracking with configurable confidence thresholds, smoothing, and stability.
Key Features:
Performance:
#include <pitch.h>
Inheritance diagram for fl::audio::detector::Pitch:
Collaboration diagram for fl::audio::detector::Pitch:Public Types | |
| using | PitchCallback = void(*)(float pitch) |
| using | PitchConfidenceCallback = void(*)(float pitch, float confidence) |
| using | VoicedCallback = void(*)(u8 isVoiced) |
Public Attributes | |
| function_list< void(float hz)> | onPitch |
| PitchCallback | onPitch = nullptr |
| function_list< void(float hz)> | onPitchChange |
| PitchCallback | onPitchChange = nullptr |
| function_list< void(float hz, float confidence)> | onPitchWithConfidence |
| PitchConfidenceCallback | onPitchWithConfidence = nullptr |
| function_list< void(u8 voiced)> | onVoiced |
| VoicedCallback | onVoiced = nullptr |
Private Member Functions | |
| float | calculateAutocorrelation (const i16 *pcm, size numSamples) |
| float | calculateAutocorrelation (const i16 *pcm, size numSamples) FL_NO_EXCEPT |
| float | calculateConfidence (const fl::vector< float > &autocorr, int peakLag) const |
| float | calculateConfidence (const vector< float > &autocorr, int peakLag) const FL_NO_EXCEPT |
| int | findBestPeakLag (const fl::vector< float > &autocorr) const |
| int | findBestPeakLag (const vector< float > &autocorr) const FL_NO_EXCEPT |
| int | frequencyToPeriod (float frequency) const |
| int | frequencyToPeriod (float frequency) const FL_NO_EXCEPT |
| float | periodToFrequency (int period) const |
| float | periodToFrequency (int period) const FL_NO_EXCEPT |
| bool | shouldReportPitchChange (float newPitch) const |
| bool | shouldReportPitchChange (float newPitch) const FL_NO_EXCEPT |
| void | updatePeriodRange () |
| void | updatePeriodRange () FL_NO_EXCEPT |
| void | updatePitchSmoothing (float newPitch) |
| void | updatePitchSmoothing (float newPitch) FL_NO_EXCEPT |
Private Attributes | |
| vector< float > | mAutocorrelation |
| fl::vector< float > | mAutocorrelation |
| float | mConfidence |
| float | mConfidenceThreshold |
| float | mCurrentPitch |
| bool | mFirePitch = false |
| bool | mFirePitchChange = false |
| bool | mIsVoiced |
| float | mLastDt = 0.023f |
| float | mMaxFrequency |
| int | mMaxPeriod |
| float | mMinFrequency |
| int | mMinPeriod |
| float | mPitchChangeSensitivity |
| OneEuroFilter< float > | mPitchSmoother {1.0f, 0.5f} |
| float | mPreviousPitch |
| bool | mPreviousVoiced |
| float | mSampleRate |
| float | mSmoothedPitch |
| float | mSmoothingFactor |
| bool | mVoicedStateChanged = false |