Formant objects represent vocal tract resonance frequencies over time. Created from a Sound via formant tracking algorithms (Burg, Split-Levinson, or Willems). Formant frequencies and bandwidths are the primary acoustic correlates of vowel quality in speech.
Value
A Formant object with methods for querying formant frequencies
and bandwidths at time points or across the full contour.
Information
get_number_of_frames()- number of analysis framesget_time_step()- time step between frames (s)get_min_num_formants(),get_max_num_formants()- formant count range per frame
Point queries (single time)
get_value_at_time(formant_number, time, unit)- formant frequency at timeget_bandwidth_at_time(formant_number, time, unit)- formant bandwidth at timeget_all_values_at_time(time, max_formants, unit)- all formant values at a time point
Statistics (over time range)
get_mean(formant_number, from_time, to_time, unit)- mean formant frequencyget_standard_deviation(formant_number, from_time, to_time, unit)- standard deviationget_minimum(formant_number, from_time, to_time, unit)- minimum valueget_maximum(formant_number, from_time, to_time, unit)- maximum valueget_quantile(formant_number, quantile, from_time, to_time, unit)- quantileget_time_of_minimum(...),get_time_of_maximum(...)- time of extremum
Batch and vectorized
get_formant_track(formant_number, unit)- full track for one formantget_bandwidth_track(formant_number, unit)- full bandwidth trackget_values_at_times(formant_number, times, unit)- values at an arbitrary vector of timesget_all_formant_tracks(max_formants, unit)- all formants as a matrix
Export
as_data_frame(max_formants)- export as a data.frame, long format: one row per (frame, formant number), with columnstime,formant,frequency(Hz), andbandwidth(Hz). MatchesFormantPath$as_data_frame().save(filepath)- save to a Praat binary file
Transform
to_formant_tier(formant_number)- extract one formant as a FormantTierto_formant_modeler()- create a polynomial trajectory modeldown_to_formant_tier()- extract all formants as a FormantTier
Examples
# Self-contained example with generated tone
sound <- Sound$create_tone(duration = 1.0, frequency = 150, sampling_rate =
44100)
formant <- sound$to_formant_burg(
time_step = 0.01, max_number_of_formants = 5,
maximum_formant = 5500, window_length = 0.025, pre_emphasis_from = 50
)
f1 <- formant$get_value_at_time(formant_number = 1, time = 0.5, unit =
"hertz")
# The same analysis on a recording read from disk
sound <- Sound(system.file("extdata", "test.wav", package = "pladdrr"))
formant <- sound$to_formant_burg(
time_step = 0.01, max_number_of_formants = 5,
maximum_formant = 5500, window_length = 0.025, pre_emphasis_from = 50
)
f1_at_02s <- formant$get_value_at_time(formant_number = 1, time = 0.2, unit =
"hertz")
mean_f1 <- formant$get_mean(formant_number = 1, from_time = 0, to_time = 0,
unit = "hertz")