Type: Package
Title: Read in a 'Praat' 'TextGrid' File
Version: 0.1.2
Description: 'Praat' https://www.fon.hum.uva.nl/praat/ is a widely used tool for manipulating, annotating and analyzing speech and acoustic data. It stores annotation data in a format called a 'TextGrid'. This package provides a way to read these files into R.
License: GPL-3
Encoding: UTF-8
Depends: R (≥ 4.1.0)
Suggests: testthat (≥ 2.1.0)
RoxygenNote: 7.3.1
Imports: stats, utils, tibble, purrr, readr, stringr, plyr
URL: https://github.com/tjmahr/readtextgrid
BugReports: https://github.com/tjmahr/readtextgrid/issues
NeedsCompilation: no
Packaged: 2024-03-07 20:45:16 UTC; mahr
Author: Tristan Mahr ORCID iD [aut, cre]
Maintainer: Tristan Mahr <tristan.mahr@wisc.edu>
Repository: CRAN
Date/Publication: 2024-03-07 21:00:02 UTC

Locate the path of an example textgrid file

Description

Locate the path of an example textgrid file

Usage

example_textgrid(which = 1)

Arguments

which

index of the textgrid to load

Details

This function is a wrapper over system.file() to locate the paths to bundled textgrids. These files are used to test or demonstrate functionality of the package.

Two files are included:

  1. "Mary_John_bell.TextGrid" - the default TextGrid created by Praat's Create TextGrid command. This file is saved as UTF-8 encoding.

  2. "utf_16_be.TextGrid" - a TextGrid with some IPA characters entered using Praat's IPA character selector. This file is saved with UTF-16 encoding.

Value

Path of "Mary_John_bell.TextGrid" bundled with the readtextgrid package.


Read a textgrid file into a tibble

Description

Read a textgrid file into a tibble

Usage

read_textgrid(path, file = NULL, encoding = NULL)

read_textgrid_lines(lines, file = NULL)

Arguments

path

a path to a textgrid

file

an optional value to use for the file column. For read_textgrid(), the default is the base filename of the input file. For read_textgrid_lines(), the default is NA.

encoding

the encoding of the textgrid. The default value NULL uses readr::guess_encoding() to guess the encoding of the textgrid. If an encoding is provided, it is forwarded to ⁠[readr::locale()]⁠ and ⁠[readr::read_lines()]⁠.

lines

alternatively, the lines of a textgrid file

Value

a tibble with one row per textgrid annotation

Examples

tg <- system.file("Mary_John_bell.TextGrid", package = "readtextgrid")
read_textgrid(tg)