Code snippets

Potentially useful bits of code for data processing (so far, all Praat scripts). Let me know if you find a bug or have any questions!

Vowel measurements

Get formants 1: This script is the "more work" version where you 1. Highlight and label the vowel, 2. Adjust measurement boundaries, and 3. Get back measurements. Includes provision for monophthongs vs. diphthongs.

Get formants 2: This script is the "less work" version where you already have a CSV of the words to be measured. 1. Highlight the vowel, 2. Adjust measurement boundaries, and 3. Get back measurements.

Get formants 3: This script is the "least work" version where you already have a TextGrid with segments. 1. Click on the vowel you want, (2. Adjust measurement boundaries,) and 3. Get back measurements. Warning: highly uncommented.

Data processing

(Semi-)automated TextGrids: If you have a CSV list of words/sentences/trials, this script populates TextGrids with them. You can either mark the right interval, or fully automate it (if your data is tidy enough).

Adjust Praat TextGrids: Used to correct automatic alignment (word and seg tier). Opens files for you, zooms into problem area, 1. Fix segs, 2. Script adjusts corresponding word boundaries.

Miscellaneous

Save dialog: Toy script to save a single thing (could be altered to be multiple) when you hit the "Save" button, specifically for use when annotating a long sound file. Apparently more reliably targets the actual object you want than just ctrl+s in the editor itself?

Praat tutorial, days 1 and 2: Master script (with "answers") for introduction to Praat: Variables (string, number), commenting, printing to an info window (debugging), "paste history" function, opening sound files, creating lists (files, directories), object selection/deselection/removal, basic pausing, creating/editing TextGrids, manually and automatically; add boundaries, text, saving files, procedures (briefly), arrays and indexing (briefly).

Praat tutorial, day 3: Master script (with "answers") for introduction to Praat: UI, if statements, for loops, writing/reading CSVs, populating text grids, gathering formant data.