Sound Design Toolkit  078
Physically informed sound synthesis for everyday sounds
Fundamental frequency estimator

Typedefs

typedef struct SDTPitch SDTPitch
 Opaque data structure for a fundamental frequency estimator.
 
typedef struct SDTPitch SDTPitch
 Opaque data structure for a fundamental frequency estimator.
 

Functions

SDTPitchSDTPitch_new (unsigned int size)
 Instantiates a fundamental frequency estimator object. More...
 
void SDTPitch_free (SDTPitch *x)
 Destroys a fundamental frequency estimator instance. More...
 
void SDTPitch_setOverlap (SDTPitch *x, double f)
 Sets the analysis window overlapping ratio. Accepted values go from 0.0 to 1.0, with 0.0 meaning no overlap and 1.0 meaning total overlap. More...
 
void SDTPitch_setTolerance (SDTPitch *x, double f)
 Sets the peak detection tolerance. Always choosing the greatest NSDF peak as pitch estimation sometimes leads to wrong octave detection errors. To overcome this problem, some tolerance is introduced in the peak detection algorithm. The chosen NSDF peak is the one with lowest frequency among those with value close enough to the global maximum. A value of 0.0 always selects the global maximum, while a value of 1.0 always selects the last NSDF peak. More...
 
int SDTPitch_dsp (SDTPitch *x, double *outs, double in)
 Signal processing routine. Call this function for each sample to perform signal analysis. More...
 

Detailed Description

The pitch detection algorithm implemented in this object is discussed in the paper "A smarter way to find pitch" by Philip McLeod and Geoff Wyvill (2005) and it is based on the NSDF (Normalized Squared Differences Function), a close relative of the autocorrelation function.

Function Documentation

int SDTPitch_dsp ( SDTPitch x,
double *  outs,
double  in 
)

Signal processing routine. Call this function for each sample to perform signal analysis.

Parameters
[in]xPointer to the instance
[out]outsPointer to an array of two doubles, containing the algorithm outputs. Array members represent the following information respectively:
  1. Estimated pitch (Hz),
  2. Pitch clarity [0.0, 1.0].
[in]inInput sample
Returns
1 if output available (analysis window full), 0 otherwise
void SDTPitch_free ( SDTPitch x)

Destroys a fundamental frequency estimator instance.

Parameters
[in]xPointer to the instance to destroy
SDTPitch * SDTPitch_new ( unsigned int  size)

Instantiates a fundamental frequency estimator object.

Parameters
[in]sizeSize of the analysis window, in samples
Returns
Pointer to the new instance
void SDTPitch_setOverlap ( SDTPitch x,
double  f 
)

Sets the analysis window overlapping ratio. Accepted values go from 0.0 to 1.0, with 0.0 meaning no overlap and 1.0 meaning total overlap.

Parameters
[in]xPointer to the instance
[in]fOverlap ratio [0.0, 1.0]
void SDTPitch_setTolerance ( SDTPitch x,
double  f 
)

Sets the peak detection tolerance. Always choosing the greatest NSDF peak as pitch estimation sometimes leads to wrong octave detection errors. To overcome this problem, some tolerance is introduced in the peak detection algorithm. The chosen NSDF peak is the one with lowest frequency among those with value close enough to the global maximum. A value of 0.0 always selects the global maximum, while a value of 1.0 always selects the last NSDF peak.

Parameters
[in]xPointer to the instance
[in]fPitch estimation tolerance [0.0, 1.0]