An R script for extracting durations from Praat text grids
Praat is great for recording speech, and Praat scripting is a powerful tool for acoustic analysis. In sentence production research, Praat can be useful for analyzing participant responses. For example, sometimes we want to annotate sound files using TextGrids in order to extract timing information, like utterance duration, word duration, and pause duration, from participants' responses. Praat scripting can be used to automatically extract formant values, fundamental frequency, center of gravity, kurtosis, and many other wonderful acoustic properties (for more on acoustic analysis using Praat scripting, see here); Unfortunately, I wasn't able to find a Praat script that would simply extract the duration of labelled segments (say, the duration of every segment labelled "utterance length") from a bunch of TextGrids (though surely someone has written one). After trying (and failing) to adapt a Praat script that was originally designed to measure pause duration, I gave up and wrote a script in R. This script will pull out the duration of labelled segments from a bunch of TextGrids using the readtextgrid* package and some other data wrangling tools. The duration variables in this case are the duration between an auditory cue and the onset of speech ('beep-the'), the duration between an auditory cue and the onset of the first noun ('beep-N1'), and the full utterance duration ('full.sentence'). The script and sample Praat files can be found here.
*Mahr T (2020). _readtextgrid: Read in a 'Praat' 'TextGrid' File_. R package version 0.1.1,
<https://CRAN.R-project.org/package=readtextgrid>.
*Mahr T (2020). _readtextgrid: Read in a 'Praat' 'TextGrid' File_. R package version 0.1.1,
<https://CRAN.R-project.org/package=readtextgrid>.