Extract sound according to non-empty annotated intervals from TextGrid and create soundfiles with correspondent names.

extract_intervals(
  file_name,
  textgrid,
  tier = 1,
  prefix = NULL,
  suffix = NULL,
  autonumber = TRUE,
  path
)

Arguments

file_name

path to the soundfile

textgrid

path to the TextGrid

tier

tier number or name that should be used as base for extraction and names

prefix

character vector containing prefix(es) for file names

suffix

character vector containing suffix(es) for file names

autonumber

if TRUE automatically add number of extracted sound to the file_name. Prevents from creating a duplicated files and wrong sorting.

path

path to the directory where create extracted soundfiles.

Value

no output

Examples

# create two files in a temprary folder "test_folder" s <- system.file("extdata", "test.wav", package = "phonfieldwork") tdir <- tempdir() file.copy(s, tdir)
#> [1] FALSE
# Extract intervals according the TextGrid into the path extract_intervals( file_name = paste0(tdir, "/test.wav"), textgrid = system.file("extdata", "test.TextGrid", package = "phonfieldwork" ), path = tdir ) list.files(tdir)
#> [1] "1_t.wav" "2_e.wav" #> [3] "3_s.wav" "4_t.wav" #> [5] "concatenated.TextGrid" "concatenated.wav" #> [7] "file8431537ba2f.so" "libloc_169_8f48fc7d1db1bb3e.rds" #> [9] "libloc_191_ec655bd44ff422f6.rds" "libloc_201_40b5ab1406ba8155.rds" #> [11] "post.TextGrid" "post.wav" #> [13] "stimuli_presentation843143ecc11.Rmd" "stimuli_presentation8437373e36f.Rmd" #> [15] "test.TextGrid" "test.wav"
# [1] "e-2.wav" "s-3.wav" "t-1.wav" "t-4.wav" "test.wav"