Sound Design Toolkit 075 Physically informed sound synthesis for everyday sounds

- Main Page
- Modules
- Data Structures
- Files

Typedefs | Functions
Fundamental frequency estimator
SDTAnalysis.h: Sound analysis tools

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

## Functions
SDTPitch * | SDTPitch_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] | x | Pointer to the instance
  [out] | outs | Pointer to an array of two doubles, containing the algorithm outputs. Array members represent the following information respectively: Estimated pitch (Hz), Pitch clarity [0.0, 1.0].
  [in] | in | Input sample

Returns
  1 if output available (analysis window full), 0 otherwise

void SDTPitch_free | ( | SDTPitch * | x | ) |

Destroys a fundamental frequency estimator instance.

Parameters

  [in] | x | Pointer to the instance to destroy

SDTPitch* SDTPitch_new | ( | unsigned int | size | ) |

Instantiates a fundamental frequency estimator object.

Parameters

  [in] | size | Size 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] | x | Pointer to the instance
  [in] | f | Overlap 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] | x | Pointer to the instance
  [in] | f | Pitch estimation tolerance [0.0, 1.0]