Scripts

Table of Contents
The scripts shared here are first and foremost intended as a lab archive, providing script snippets we frequently use. This means they require customization for each individual new project. Use at your own risk!

Praat

Many (but not all!) of the scripts shared here are for use in Praat, the most commonly used software package for phonetic research. Over the years, Praat has had three types of syntax:

  • Extract part... 0 0.1 rectangular 1 no (Praat versions 5.3.43 and older; before April 2013)
  • do("Extract part", 0, 0.1, "rectangular", 1, "no") (between 5.3.44 and 5.3.62; April 2013 - January 2014)
  • Extract part: 0, 0.1, "rectangular, 1, "no" (5.3.63 and after; after January 2014)

Current Praat versions are compatible with older and newer syntax types, and mixes thereof. The Praat scripts shared here primarily use the first type of syntax (…shows my age), with occasional lines using the latest type of syntax. [ADVERTISEMENT:] Did you know the syntax highlighting in PraatVSCode works with either syntax?


List of available scripts

  • Elevenlabs: Generate speech

    This Python script performs AI text-to-speech synthesis using Elevenlabs. It takes a list of prompts as input and generates individual .mp3 files for each prompt. It also automatically performs forced-alignment on the output speech using WebMAUS, giving you accompanying TextGrid files with word-level, syllable-level, and phoneme-level annotations.

  • WebMAUS: Forced-alignment

    This Python script performs forced-alignment using WebMAUS. It takes pairs of sound files + text files with the same filename (item1.wav + item1.txt) as input and matches the orthographic words in the txt file to the sounds, syllables, and words in the sound file.

  • Praat: Annotate

    This Praat script streamlines an annotation workflow: it presents a TextGrid for manual annotation to the user, you perform some changes, and when you click Next, it automatically saves the changes and presents the next TextGrid, and so on.

  • Praat: Batch processing

    This Praat script is an in-house template / starting point for batch processing multiple files. Adapt it to your own needs to apply a particular function to multiple files or multiple time intervals within each file.

  • Praat: Save all

    Praat can only save one object at a time for you. If you have multiple objects in your object window you’d like to save in one go, you can use this script.

  • Praat: Move to zero-crossings

    This Praat script automatically moves all boundaries in a given tier in a TextGrid file to zero-crossings, which is important for extracting sound intervals. Specifically, it adds a tier ’to0x’ at the top of the TextGrid that is identical to a given input tier, except that all boundaries are at zero-crossings.

  • Praat: Manipulate ITD/IID

    This Praat script allows you to create a ‘virtual auditory reality’ by implementing interaural time differences (ITD) and interaural intensity differences (IID) for two sounds. Thus we simulate naturalistic perception of two fully lateralized sound sources.

  • Praat: Interpolate F0 continuum

    This Praat script creates an F0 continuum for two segmentally matching words (e.g., SUBject vs. subJECT). First, it matches the two words in duration and then interpolates the F0 contour linearly in 11 steps (steps 1 and 11 being the original contours), controlling for intensity.

  • Praat: Manipulate formants

    This Praat script gradually shifts a formant track (here: first formant, F1) to create a phonetic continuum from high-to-low (e.g., from “bet” to “bit”). It takes a list of word pairs as input, reads the first member, and applies the formant shift while controlling for intensity and f0.

  • Praat: Transplant intensity contour

    This Praat script takes pairs of items (e.g., bet and bit) from a directory and transplants the intensity contour of word2 onto word1. It does so by first scaling the duration of word2 to be identical to that of word1, and then transplanting the duration-scaled intensity contour onto word1.

  • Praat: Dynamic Time Warping

    This Praat script takes pairs of items (e.g., bet and bit) from a directory and matches the duration of individual speech sounds in word1 to the duration of individual speech sounds in word2 (…a kind of simplistic Dynamic Time Warping).


Not finding what you were looking for? There are thousands of other Praat scripts available online. Some resources with particularly useful code are:

License

All scripts are shared under an MIT license.

2023, Hans Rutger Bosker