Phonetics Lab Scripting

From Joint Lab Wiki
Jump to navigation Jump to search

Praat Scripts[edit | edit source]

New to Praat scripting? See Amandalynne's talk on Praat scripting basics File:PraatScripting.zip , or Matt Winn's talk on more Praat Scripting File:PraatScripting2.zip.

Arpabet Vowel Analyzer (John Riebold)

A script designed to extract vowel formants, duration, timestamps, and other information from P2FA-generated TextGrids.

Arpabet Hand-Corrector (John Riebold)

Forced-aligned TextGrids must be hand-corrected before any automated measurement can be done. This script is designed to speed up the process and be customized to fit the needs of the analyst.

Get duration, pitch, formants (Dan McCloy)

This script cycles through a directory of sound files and matching text grids and extracts the duration and midpoint f0, F1, and F2 of every TextGrid interval that has a label, and writes it all to a tab-delimited file. It is a modification of one of Mietta Lennes's scripts.

Get duration, pitch, formants (Stella Podgornik)

This script is similar to the one above but is optimized for command-line interface. It extracts pitch, duration, and F1-2-3 at 20-50-80% of each labeled interval of a specified tier, writing them all to a tab-delimited text file. It can be batch-run over multiple wav/textgrid pairs residing within specified folders. It is a modification of a Mietta Lennes script.

Get duration, pitch, intensity, formants (Esther Le Grézause)

This script, originally written by Mietta Lennes and modified by Dan McCloy, cycles through a directory of sound files and matching text grids and extracts the duration and midpoint f0, F1, and F2 of every TextGrid interval that has a label, and writes it all to a tab-delimited file. It has been further modified to extract intensity and to collect matching interval labels on other tiers at the same midpoint.

Grand-analyzer (Valerie Freeman)

Measures pretty much everything in a word and/or vowel, with many user-defined input options. An ongoing work in progress.

Remeasure (John Riebold)

Editor window script for measuring vowels at 20%, 50%, and 80% of vowel duration and extracting various metadata, modeled on Wassink's pnwe_get_205080.

Semi-auto formant analysis (August McGrath & Dan McCloy)

This script is the formant-oriented version of the pitch extractor below. It cycles through a directory of TextGrids, finds matching sound files in a specified folder, and displays each in sequence, automatically showing a table of F1, F2, F3 values at specified time points through the interval, and prompting the user to accept the values, modify formant settings, or mark for hand-measurement. Measurements are written to a tab-delimited file.

Semi-auto pitch analysis (Dan McCloy)

This reasonably well-commented script cycles through a directory of TextGrids, finds matching sound files in a specified folder, and displays each in sequence, automatically placing the cursor at the midpoint of labelled intervals and prompting the user to accept, modify, or override the pitch measurement. Measurements are written to a tab-delimited file.

File:Tier-scripts.zip (Valerie Freeman)

Quick Praat scripts for various TextGrid tier manipulations (splitting, renaming, etc.)

Vowel Analyzer (John Riebold)

A script designed to extract vowel formants, duration, timestamps, and other information from TextGrids.

More coming soon. If you don't see a script here that will meet your needs, check Mietta Lenne's page, the UCLA Praat scripts page, or the praat-tools codebase maintained by the Speech Prosody Studies Group.

Automated LPC Spectral Peak Extrapolator (Ted K. Kye)

(Incomplete) A script that extrapolates LPC peaks using a Linear Predictive Coding (LPC) Autocorrelation algorithm. This script was originally written by Gina Cook (2006), and later modified by Ted Kye (2018).

Python Scripts[edit | edit source]

"Play Stimuli and Record Verbal Responses" (Dan McCloy)

This script, from Dan McCloy plays stimuli for participants and records their verbal responses. It was used for the gender and intelligibility study.

PraatIO (Tim Mahrt)

This is a package from Tim Mahrt (not in the lab), for manipulating Praat data in python. It is useful for data that has "hierarchical time-aligned transcriptions (utterance > word > syllable > phone, etc).

Translate to CMU Dictionary (Sara Ng)

A simple function for translating into CMU phonetic transcriptions.

MATLAB Scripts[edit | edit source]

RMS leveler

Here is a MATLAB function for RMS levelling WAV files, written by Dan McCloy. It will either RMS level a set of files to the maximum possible level without causing clipping, or alternatively, you can pass it a target file with a desired RMS and it will match the new files to the target file. Note that it depends on another MATLAB function cell2csv.m (from the MATLAB exchange website).

VOIS3D

A Matlab program for plotting vowels in 3D (F1 x F2 x duration) and calculating overlap between categories, written by Alicia Wassink. Used extensively in the Pacific Northwest English Project.

genericLookup

A general-purpose lookup script for text documents. Takes an input text file of one item per line, and a lookup table of two items per line. Handy for output files that are randomized by subject, where you want to convert, e.g., stimulus numbers to actual stimulus text, while maintaining the randomization order through the conversion.

R Code[edit | edit source]

File:Generate-trajectory-plots.txt (John Riebold)

Description: This script plots vowel trajectories from three timepoints, and when run on data sets with multiple speakers, will automatically calculate means and generate plots (with matching axes) for each speaker in the set.

File:SSANOVA-R-Code-NWAVdemo.txt (Alicia Wassink)

Description: Script from Wassink & Koops, 2013 (NWAV 2013 presentation) for plotting SS-ANOVA vowel trajectory curves.


Plotting a vowel space with Unicode labels

If you already know the basics and just want to make beautiful vowel plot graphs, install the phonR package (written by Dan McCloy). PhonR is an R package for normalization and plotting of vowels. It's similar in function to Tyler Kendall's vowels.r, but with additional functionality and flexibility.

There is also a brief tutorial on how to use phonR.