Example usage

library(tjm.praat)

tg <- system.file(
  "demo-textgrids/merge-duplicate-intervals.TextGrid",
  package = "tjm.praat"
)

tg_out <- tempfile("test", fileext = ".TextGrid")

# We have the phonemes and silences in "bird house"
tg_data <- readtextgrid::read_textgrid(tg)
tg_data[tg_data$tier_num == 2, c("tier_name", "xmin", "xmax", "text")]

f_convert_tier_to_silences <- wrap_praat_script(
  script_code_to_run = convert_tier_to_silences,
  returning = "last-argument"
)

tg_data2 <- tg |> 
  f_convert_tier_to_silences("phones", "^$|sil|sp", tg_out) |>
  readtextgrid::read_textgrid()

tg_data2[tg_data2$tier_num == 2, c("tier_name", "xmin", "xmax", "text")]

Praat source code

print(f_convert_tier_to_silences, condense = FALSE)


tjmahr/tjm.praat documentation built on May 25, 2023, 5:41 p.m.