Make Praat Picture-style plots of acoustic data in R

Author

Rasmus Puggaard-Rode

Published

October 14, 2024

Preface

Getting started

Many phoneticians and linguists use R for a big portion of their data processing and analysis pipeline, and increasingly also for preparing manuscripts and presentations using the RMarkdown and Quarto formats. A big advantage of these formats is the ability to generate plots on the fly using R code. A very important visualization in the phonetician’s arsenal shows one or more time-aligned signals (such as waveform, spectrogram, or pitch) together with an annotation. These are usually made in Praat. praatpicture – named in tribute of Praat’s plotting GUI – implements this kind of visualization as a base R plot. The package provides easy and fast out-of-the-box solutions but also a high extent of flexibility.

Version 1.3.0 of praatpicture is in the R package repository CRAN, and can be installed with the following command:

install.packages('praatpicture')

praatpicture is being continuously updated, and the current development version can always be installed from GitHub. Bug fixes and new functionality will be introduced in the development version before they are introduced to CRAN. You can install the development version using the package devtools like so:

devtools::install_github('rpuggaardrode/praatpicture')

You can now load the library and make a Praat Picture style-plot using a very simple praatpicture() command pointing to the name of a sound file with the .wav extension:

library(praatpicture)
praatpicture('ex/index.wav')

praatpicture has many other options and functions for customizing these figures. These are covered in detail in the following chapters.

Citing praatpicture

A fair amount of time goes into making praatpicture, so if you use it for publications, please consider citing it!

You can either cite the R package directly, or refer to this paper:

Puggaard-Rode, Rasmus (2024) praatpicture. A library for making flexible Praat Picture-style figures in R. In Cécile Fougeron & Pascal Perrier (eds.), Proceedings of the 13th International Seminar on Speech Production, 115–118.

Crucial libraries and data sources

The following libraries are crucial for the functionality of praatpicture:

  • av is used to make MP4 videos with embedded audio and animations
  • emuR is used for EMU-SDMS integration
  • gifski is used to make GIF animations
  • gsignal is used for power-to-decibel conversion
  • ipa is used to dynamically convert SAMPA to IPA
  • phonTools is used to generate spectrograms
  • rPraat is used to import TextGrids and derived signals calculated in Praat into R
  • soundgen is used to used for Hertz-to-ERB conversion
  • tuneR is used to import WAV files into R
  • wrassp is used for calculating pitch, formants, and intensity on the fly

The Shiny implementation relies on the shiny, shinyjs, and bslib libraries.

The data used for illustrations in this manual come from a few different sources:

  • This repository with recordings in Eastern Khmu’ associated with a paper from Kirby et al. 2023
  • Multichannel data in Tzotzil was shared with me by Heriberto Avelino
  • Danish data was gathered by myself. You hear and see the voice of Søren Sandager Sørensen

Bug reports, suggestions, ideas

If you run into any problems using praatpicture, I’m very happy to hear about them! Feel free to file an issue on GitHub, or reach out via e-mail.