Internal soundgen function.
getPitchSpec(
frame,
bin,
freqs,
specMethod = c("commonFactor", "BaNa")[1],
specRatios,
specSmooth,
specThres,
specMerge,
specPeak,
specHNRslope,
HNR = NULL,
specSinglePeakCert,
pitchFloor,
pitchCeiling,
nCands
)
Returns either NULL or a dataframe of pitch candidates.
the abs spectrum of a frame, as returned by
fft
the width of spectral bin in frame
, Hz
frequency per bin of spectrogram
"commonFactor" = highest common factor of putative harmonics, "BaNa" = ratio of putative harmonics
for method = "commonFactor", the number of harmonics AND integer fractions to consider
the width of window for detecting peaks in the spectrum, Hz
voicing threshold (unitless, ~0 to 1)
pitch candidates within specMerge
semitones are
merged with boosted certainty
when looking for putative harmonics in
the spectrum, the threshold for peak detection is calculated as
specPeak * (1 - HNR * specHNRslope)
harmonics-to-noise ratio returned by getPitchAutocor
(0 to 1) if f0 is calculated based on a single
harmonic ratio (as opposed to several ratios converging on the same
candidate), its certainty is taken to be specSinglePeakCert
absolute bounds for pitch candidates (Hz)
number of pitch candidates pre frame (specMethod = "commonFactor" always returns a single candidate)
Attempts to find F0 of a frame by detecting several putative harmonics and either finding their highest common factor (specMethod = "commonFactor") or comparing their ratios (specMethod = "BaNa"). For the highest common factor method, see Howard & Angus (2017) "Acoustics and psychoacoustics" (section 3.2.1). For BaNa, see Ba et al. (2012) "BaNa: A hybrid approach for noise resilient pitch detection." Statistical Signal Processing Workshop (SSP), 2012 IEEE.