Krotos Modules 3
Loading...
Searching...
No Matches
krotos::McLeod Class Reference

An implementation of the 'McLeod Pitch Method': http://miracle.otago.ac.nz/tartini/papers/A_Smarter_Way_to_Find_Pitch.pdf. More...

#include <McLeod.h>

Public Member Functions

 McLeod ()
 
 McLeod (double sampleRate, int bufferSize)
 
 ~McLeod ()
 
void initialise (double newSampleRate, int newBufferSize)
 
float getPitch (std::vector< float > InputBuffer)
 
float getPitch (const float *InputBuffer, int numSamples)
 

Private Member Functions

float getPitchInternal ()
 
void calculateNormalisedSquareDifferenceFunction (std::vector< float > buffer)
 
void peakPicking ()
 
void parabolicInterpolation (int tauEstimation)
 

Private Attributes

const float DEFAULT_SAMPLE_RATE {44100}
 
const int MAX_BUFFER_SIZE {1024}
 
const float SMALL_CUTOFF {0.5}
 
const double CUTOFF {0.97}
 
const float LOWER_PITCH_CUTOFF {40}
 
const double PI {3.14159265358979323846}
 
const double TWO_PI {2 * PI}
 
int bufferSize
 
int peakPositionsIndex
 
int periodEstimatesIndex
 
int amplitudeEstimatesIndex
 
float interpolatedX
 
float interpolatedY
 
double sampleRate
 
std::vector< int > peakPositions
 
std::vector< float > mcLeodBuffer
 
std::vector< float > periodEstimates
 
std::vector< float > amplitudeEstimates
 
std::vector< float > window
 

Detailed Description

An implementation of the 'McLeod Pitch Method': http://miracle.otago.ac.nz/tartini/papers/A_Smarter_Way_to_Find_Pitch.pdf.

Note from Doug: From having a play around with this a good buffer size seems to be 1024. Smaller buffer sizes allow tracking at a higher frequency range, but at the expense of stability/accuracy of the result.

Constructor & Destructor Documentation

◆ McLeod() [1/2]

krotos::McLeod::McLeod ( )

◆ McLeod() [2/2]

krotos::McLeod::McLeod ( double sampleRate,
int bufferSize )

◆ ~McLeod()

krotos::McLeod::~McLeod ( )

Member Function Documentation

◆ calculateNormalisedSquareDifferenceFunction()

void krotos::McLeod::calculateNormalisedSquareDifferenceFunction ( std::vector< float > buffer)
private

◆ getPitch() [1/2]

float krotos::McLeod::getPitch ( const float * InputBuffer,
int numSamples )

◆ getPitch() [2/2]

float krotos::McLeod::getPitch ( std::vector< float > InputBuffer)

◆ getPitchInternal()

float krotos::McLeod::getPitchInternal ( )
private

◆ initialise()

void krotos::McLeod::initialise ( double newSampleRate,
int newBufferSize )

◆ parabolicInterpolation()

void krotos::McLeod::parabolicInterpolation ( int tauEstimation)
private

◆ peakPicking()

void krotos::McLeod::peakPicking ( )
private

Member Data Documentation

◆ amplitudeEstimates

std::vector<float> krotos::McLeod::amplitudeEstimates
private

◆ amplitudeEstimatesIndex

int krotos::McLeod::amplitudeEstimatesIndex
private

◆ bufferSize

int krotos::McLeod::bufferSize
private

◆ CUTOFF

const double krotos::McLeod::CUTOFF {0.97}
private

◆ DEFAULT_SAMPLE_RATE

const float krotos::McLeod::DEFAULT_SAMPLE_RATE {44100}
private

◆ interpolatedX

float krotos::McLeod::interpolatedX
private

◆ interpolatedY

float krotos::McLeod::interpolatedY
private

◆ LOWER_PITCH_CUTOFF

const float krotos::McLeod::LOWER_PITCH_CUTOFF {40}
private

◆ MAX_BUFFER_SIZE

const int krotos::McLeod::MAX_BUFFER_SIZE {1024}
private

◆ mcLeodBuffer

std::vector<float> krotos::McLeod::mcLeodBuffer
private

◆ peakPositions

std::vector<int> krotos::McLeod::peakPositions
private

◆ peakPositionsIndex

int krotos::McLeod::peakPositionsIndex
private

◆ periodEstimates

std::vector<float> krotos::McLeod::periodEstimates
private

◆ periodEstimatesIndex

int krotos::McLeod::periodEstimatesIndex
private

◆ PI

const double krotos::McLeod::PI {3.14159265358979323846}
private

◆ sampleRate

double krotos::McLeod::sampleRate
private

◆ SMALL_CUTOFF

const float krotos::McLeod::SMALL_CUTOFF {0.5}
private

◆ TWO_PI

const double krotos::McLeod::TWO_PI {2 * PI}
private

◆ window

std::vector<float> krotos::McLeod::window
private

The documentation for this class was generated from the following files: