PitchACF Class Reference

Algorithm to estimate the most prominent pitch of a vector of Real values reprsenting the FFT of an audio frame using the Autocorrelation function. More...

#include <PitchACF.h>

Collaboration diagram for PitchACF:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 PitchACF (int fftSize=1024, Real samplerate=1.0, int minimumPeakWidth=6, int peakCandidateCount=10)
 ~PitchACF ()
void process (const MatrixXR &spectrums, MatrixXR *pitches, MatrixXR *saliencies)
int fftSize () const
void setFftSize (int size, bool callSetup=true)
int minimumPeakWidth () const
void setMinimumPeakWidth (int width, bool callSetup=true)
int peakCandidateCount () const
void setPeakCandidateCount (int count, bool callSetup=true)
Real samplerate () const
void setSamplerate (Real frequency, bool callSetup=true)


Detailed Description

Algorithm to estimate the most prominent pitch of a vector of Real values reprsenting the FFT of an audio frame using the Autocorrelation function.

This class represents an object to estimate the most prominent pitch of a vector of Real values reprsenting the FFT of an audio frame using the Autocorrelation function.

The algorithm performs an autocorrelation on the input spectrums and finds the first peak of a set of highest magnitude candidates. The index of the peak and the values of the peak will determine the pitch frequency and saliency.

The minimum peak width can be specified using setMinimumPeakWidth().

The number of candidates at the peak detection stage be specified using setPeakCandidateCount().

Author:
Ricard Marxer
See also:
PitchACF, PitchSaliency, PitchInvp

Constructor & Destructor Documentation

PitchACF ( int  fftSize = 1024,
Real  samplerate = 1.0,
int  minimumPeakWidth = 6,
int  peakCandidateCount = 10 
)

Constructs an autocorrelation based pitch estimation function object with the specified fftSize, samplerate, minPeakWidth and peakCandidateCount settings.

Parameters:
fftSize size of the input FFT frames, must be > 0.
samplerate the samplerate of the input signal. By default it is 1.0, so the pitches will be returned in normalized frequencies.
minimumPeakWidth the minimum width of a peak in the autocorrelation function for it to be detected.
peakCandidateCount the number of highest magnitude candidates to be considered during the peak detection process of the autocorrelation function.

References setFftSize(), setMinimumPeakWidth(), setPeakCandidateCount(), and setSamplerate().

~PitchACF (  ) 

Destroys the algorithm and frees its resources.


Member Function Documentation

void process ( const MatrixXR &  spectrums,
MatrixXR *  pitches,
MatrixXR *  saliencies 
)

Performs a pitch estimation on each of the rows of spectrums. Puts the resulting estimated pitches in the rows of pitches and the saliencies of each pitch in the rows of saliencies.

Parameters:
spectrums matrix of Real values representing one spectrum magnitude per row. The number of columns of spectrum must be equal to the fftSize / 2 + 1 where fftSize is specified using setFftSize().
pitches pointer to a matrix of Real values representing the frequencies of the estimated pitches as rows. The matrix should have the same number of rows as spectrums and as many columns as the count of estimated pitches. Note that this algorithm is only capable of detecting a single pitch at each frame, therefore pitches will be a single column matrix.
saliencies pointer to a matrix of Real values representing the saliencies of the estimated pitches as rows. The matrix should have the same number of rows as spectrums and as many columns as the count of estimated pitches. Note that this algorithm is only capable of detecting a single pitch at each frame, therefore pitches will be a single column matrix.
Note that if the output matrices are not of the required sizes they will be resized, reallocating a new memory space if necessary.

References PeakInterpolation::process(), PeakDetection::process(), and Autocorrelation::process().

int fftSize (  )  const

Returns the size of the FFT that has been performed for the input. The default is 1024.

See also:
setFftSize()

void setFftSize ( int  size,
bool  callSetup = true 
)

Specifies the size of the FFT that has been performed for the input. The given size must be higher than 0.

See also:
fftSize()

Referenced by PitchACF().

int minimumPeakWidth (  )  const

Returns the minimum width for a peak to be detected in the autocorrelation function. The default is 6.

See also:
setMinimumPeakWidth()

void setMinimumPeakWidth ( int  width,
bool  callSetup = true 
)

Specifies the minimum width for a peak to be detected in the autocorrelation function.

See also:
minimumPeakWidth()

Referenced by PitchACF().

int peakCandidateCount (  )  const

Returns the number of highest magnitude candidates to be considered during the peak detection process of the autocorrelation function.

Note that if the value is <= 0, then no preselection is performed and all detected peaks are considered as candidates.

By default it is 6.

void setPeakCandidateCount ( int  count,
bool  callSetup = true 
)

Specifies the number of highest magnitude candidates to be considered during the peak detection process of the autocorrelation function.

Note that if the value is <= 0, then no preselection is performed and all detected peaks are considered as candidates.

Referenced by PitchACF().

Real samplerate (  )  const

Return the samplerate frequency of the input signal. The default is 44100.0.

See also:
setSamplerate

void setSamplerate ( Real  frequency,
bool  callSetup = true 
)

Specifies the samplerate frequency of the input signal.

See also:
samplerate

Referenced by PitchACF().


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

Generated on Tue Mar 31 20:38:33 2009 for Loudia by  doxygen 1.5.6