47 void loadSignal(
const float* signal,
int size);
A utility class for estimating the pitch (fundamental period) of a given audio signal segment.
Definition pitch_detector.h:18
float findYinPeriod(int max_period)
Searches for a period using a YIN-like algorithm, up to a specified maximum period.
Definition pitch_detector.cpp:65
float matchPeriod(int max_period)
High-level method to find the best matching period using the YIN approach.
Definition pitch_detector.cpp:95
int size_
Number of samples in the loaded signal.
Definition pitch_detector.h:86
void setSize(int size)
Sets the internal size of the signal used for pitch detection.
Definition pitch_detector.h:37
void loadSignal(const float *signal, int size)
Loads a signal into the PitchDetector for analysis.
Definition pitch_detector.cpp:17
static constexpr int kNumPoints
A fixed number of points used in the period error computation.
Definition pitch_detector.h:25
std::unique_ptr< float[]> signal_data_
Buffer holding the loaded signal samples.
Definition pitch_detector.h:87
float getPeriodError(float period)
Computes the error metric for a given period length.
Definition pitch_detector.cpp:24
PitchDetector()
Constructs a PitchDetector with no loaded signal.
Definition pitch_detector.cpp:12
const float * data() const
Returns a pointer to the internal signal data buffer.
Definition pitch_detector.h:83