Pitch

Pitch
 
Formal definition: Pitch is measured in Hz or cycles per second. We calculate two pitch estimates: harmonic pitch and mean frequency.
Mean frequency is defined above whereas:

graphic

Harmonic_Pitch is calculated as cepstrum peak (calculated upon the spectrum of log spectrum) but instead of log spectrum we use the derivative spectrum. At any given time, pitch might be either harmonic, sinusoidal (whistle) or not well-defined. In the two later cases, mean frequency provides an appropriate pitch estimate.
Hence, at time window t, we calculate pitch according to three threshold parameters T1, T2, T3.

Pitch t= mean frequency
IF harmonic estimate is higher than T1
OR if Wiener entropy is lower than T2 & Goodness of pitch is lower than T Otherwise Pitch t = harmonic pitch


Note that  harmonic pitch is typically low, hence we reject harmonic pitch estimates that are higher than the natural range (e.g., in zebra finch harmonic pitch rarely approaches 2kHz).



Pitch is a measure of the period of oscillation. It is the only feature that requires careful adjustments based on three parameters. Tonal pitch, as in a whistle, is simply THE frequency of the sound, whereas harmonic pitch is an estimate of the fundamental-frequency of a complex sound composed of harmonically related frequencies. The fundamental is equivalent to the typical frequency difference between consecutive harmonics (the common denominator of the harmonics). The main challenge is the automatic distinction between tonal pitch and harmonic pitch: this distinction is species-specific and might vary with recording conditions as well. Nevertheless, pitch is a central feature of song, and with careful adjustments, one can often obtain a good estimate. Furthermore, when we calculate the mean pitch of a syllable, we adjust the weight of each time window by the goodness of pitch, which often stabilizes the mean pitch estimate of that syllable type.

SAP2 distinguishes between the two based on three considerations: first, harmonic pitch is often frequency bounded, e.g. in zebra finches we rarely see harmonic sounds with a fundamental higher than 1800Hz. Therefore, we reject a cepstral estimate higher than this threshold and prefer the mean frequency estimate.  Second, if the goodness of pitch is very low, pitch is unlikely to be harmonic. Third, if both goodness of pitch and Wiener entropy are low, pitch is even less likely to be harmonic. You can manipulate those parameters in the options.