**DEPRECATED:** This function is deprecated in favor of the R6 interface. Use `sound$to_formant_burg()` instead.
Usage
extract_formants(
sound,
time_step = 0,
max_formant = 5500,
n_formants = 5,
window_length = 0.025,
pre_emphasis_from = 50
)Arguments
- sound
A praat_sound object created by
read_soundorcreate_sound- time_step
Time step in seconds for formant analysis (0 = auto: 4x Nyquist)
- max_formant
Maximum formant frequency in Hz (default: 5500 for adult female, use 5000 for adult male, 8000 for child)
- n_formants
Number of formants to track (default: 5)
- window_length
Analysis window length in seconds (default: 0.025)
- pre_emphasis_from
Pre-emphasis frequency in Hz (default: 50)
Value
Depends on the class of sound:
If
soundis an R6Soundobject (the normal case —Sound()/Sound$create_tone()always create one), this function delegates entirely tosound$to_formant_burg()and returns an R6Formantobject. This is whatget_formant_at_time/get_mean_formantdo NOT accept — those two expect the legacy list below.If
soundis a legacy (pre-R6)praat_soundlist, returns a plain, unclassed list with elementsvalues(a data.frame with columnstime,formant_number,frequency,bandwidth),n_frames,time_step,max_formant, andn_formants. This list is no longer given a"praat_formant"class (removed when the package's S3 object system was fully migrated to R6), so it will not satisfyis_praat_formant()/get_formant_at_time/get_mean_formantwithout manually addingclass(x) <- "praat_formant"first.
Details
Analyzes formant frequencies (vocal tract resonances) from a sound object using Praat's Burg algorithm.
Examples
# sound is an R6 Sound object here, so this delegates to to_formant_burg()
# and returns an R6 Formant object (see the second value's \value above).
sound <- Sound$create_tone(frequency = 220, duration = 0.5, sampling_rate =
16000)
formants <- extract_formants(sound, max_formant = 5500)
#> Warning: extract_formants() is deprecated and will be removed in v6.0.0. Use the R6 interface: sound$to_formant_burg()
f1_mean <- formants$get_mean(formant_number = 1)
# Equivalent, and the recommended way to spell it directly:
formants2 <- sound$to_formant_burg(max_frequency = 5500)
f1_mean2 <- formants2$get_mean(formant_number = 1)