Track fundamental frequency using the Snack/ESPS dp_f0 algorithm
trk_pitch_snack.RdExtracts F0, voicing probability, RMS energy, and autocorrelation peak using
the Snack Sound Toolkit normalized cross-correlation + dynamic-programming pitch
tracker (dp_f0, Talkin 1995). Unlike trk_pitch_rapt, which
returns only F0, this function exposes all four tracks for downstream signal
quality assessment.
Usage
trk_pitch_snack(listOfFiles, beginTime = 0, endTime = 0, windowShift = 10, minF = 50, maxF = 550, voiceBias = 0, toFile = TRUE, explicitExt = "snackpitch", outputDirectory = NULL, verbose = TRUE)Arguments
- listOfFiles
Character vector of audio file paths. Any format supported by av is accepted; non-native inputs are transcoded automatically.
- beginTime
Numeric. Start of analysis window in seconds. Default 0 (file start).
- endTime
Numeric. End of analysis window in seconds. Default 0 (file end).
- windowShift
Numeric. Frame shift in milliseconds; sets output frame rate (1000 / windowShift Hz). Default 10.0 ms.
- minF
Numeric. Minimum F0 in Hz. Default 50.0 Hz.
- maxF
Numeric. Maximum F0 in Hz. Default 550.0 Hz.
- voiceBias
Numeric. Bias toward the voiced hypothesis in the DP cost function (range approximately −0.5 to 0.5; positive = more voiced frames). Default 0.0.
- toFile
Logical. If
TRUE, write SSFF output files and return the count written invisibly. IfFALSE, return anAsspDataObj. DefaultTRUE.- explicitExt
Character. Output file extension. Default
"snackpitch".- outputDirectory
Character. Directory for output files.
NULL(default) writes alongside the input file.- verbose
Logical. Print per-file progress. Default
TRUE.
Value
If toFile = FALSE: an AsspDataObj with tracks:
f0REAL32, fundamental frequency in Hz, n_frames × 1. Zero indicates unvoiced frames.
voicingREAL32, voicing probability, 0–1, n_frames × 1.
rmsREAL32, RMS energy (linear), dimensionless, n_frames × 1.
acpeakREAL32, autocorrelation peak magnitude, 0–1, n_frames × 1.
Frame rate: 1000 / windowShift Hz (default 100 Hz).
If toFile = TRUE: integer count of files written, returned invisibly.
Examples
if (FALSE) { # \dontrun{
# Full 4-track pitch analysis
res <- trk_pitch_snack("recording.wav", toFile = FALSE)
names(res) # "f0" "voicing" "rms" "acpeak"
# Custom F0 range
trk_pitch_snack("speech.mp3", minF = 75, maxF = 300)
} # }