extract_intervals {phonfieldwork}R Documentation

Extract intervals

Description

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

Usage

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

Author(s)

George Moroz <agricolamz@gmail.com>

Examples

# create two files in a temprary folder "test_folder"
s <- system.file("extdata", "test.wav", package = "phonfieldwork")
tdir <- tempdir()
file.copy(s, tdir)

# 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] "e-2.wav" "s-3.wav" "t-1.wav" "t-4.wav" "test.wav"

[Package phonfieldwork version 0.0.17 Index]