Below you will find a list of praat scripts that I put together, and a tutorial on measuring F0 and formants with ProsodyPro and FormantPro, and a list of problems commonly encountered in using praat scripts. Feel free to email me if you run into problems/bugs.
I am heavily indebted to Mauricio Figueroa (now at Universidad de Concepción, Chile) for his Praat scripting workshop at Cambridge, 2015, and for his excellent Praat syntax highlighter for Sublime Text, which makes scripting so much easier.
Home-made praat scripts
This is my go-to script for presenting production stimuli. All you need to provide is a txt file of a word list. The script will randomise your list and present words one by one for recording, and save the word list in the order as presented. You can set the carrier phrase and the number of repetitions.
Combining powerfully with [Production_stimuli_presentation.praat.praat], this script labels a textgrid with information from a word list text file, to save you from the trouble of typing every interval manually. The ideal workflow for creating an annotated textgrid for a recording is to: prepare a text file, each word each line; create a textgrid, and segment the boundary of each interval; use this script to fill the textgrid with labels from your word list.
This script measures the durations of filled intervals for all textgrids in a folder. These durations are stored in a resulting textfile. You can select which tier of the textgrids to measure.
This script resamples all files within a folder. You can specify the new sample rate. This allows you to concatenate files that otherwise have different sample rates and cannot be combined. Lowering sample rates also reduces the file size.
This script converts all two-channel wav files into mono-channel files. This allows you to concatenate files that otherwise have different channels and cannot be combined. Removing one channel also halves the file size.
This script scales all files in a directory to a common amplitude peak. Essentially, they are scaled to become equally loud, which is useful if you want to play these files in experiments or in presentations.
This script is useful for creating experimental stimuli. It concatenates all sounds in a directory into pairs, with a silent interval in between, the duration of which you can specify. For example, if you have a.wav, b.wav, c.wav, you will obtain 6 combinations:
a_b.wav, a_c.wav, b_c.wav
b_a.wav, c_a.wav, c_b.wav
You will also get a_a.wav, b_b.wav, c_c.wav if you click "yes" to combine identical files.
Within each pair, the two sounds are separated by a silent interval.
This script has minor variation from the last one. In this you have the option to only combine identical files. If you have a.wav, b.wav, c.wav, you will obtain 3 combinations under the option:
a_a.wav, b_b.wav, c_c.wav
Within each pair, the two sounds are separated by a silent interval.
This script takes all sounds in one directory, and attach sounds in the other directory to the former. For example, if you have in
directory One: A.wav, B.wav, C.wav
directory Two: a.wav, b.wav
You will end up with: A_a.wav, B_a.wav, C_a.wav, A_b.wav, B_b.wav, C_b.wav
This is useful if you have, say, a suffix sound which you want to attach to all basic sounds
This script concatenates all sounds in a directory into a combined file, with a silent interval in between each constituent file, the duration of which you can specify. For example, if you have a.wav, b.wav, c.wav, you will obtain one file in which "a" is followed by "b", followed by "c", all separated by a silent interval.
This script allows you to batch save selected sound files in your praat workspace to a folder you specify. This allows you to batch process files without relying too much on other scripts. For example, you can drag a number of sounds into Praat, remove noise (filter - remove noise), then use this script to save the resulting files.
This script adds importing function to [Save_selected_sounds.praat]. It sends all wav files from a folder of your choice to the Praat objects window. After processing those sounds, you can then select some or all of them and save these to a specified folder. See detailed instruction contained in the script.
Measuring pitch and formants
To measure pitch (and voice quality) and formants, I recommend Prof Yi Xu's ProsodyPro and FormantPro, respectively. Below is a very brief description of the workflow, assuming you already have annotated textgrids with your sound files. You can watch a 90-second screencast of me going through these steps.
- Have your sound files and textgrids in the same folder. Pairs of sound files and textgrids must have identical names.
- Download and place ProsodyPro/FormantPro in that folder.
- Open ProsodyPro/FormantPro in Praat. Run.
- You now see a menu. You normally change the following. For "Input File No": put the number of sound-textgrid pairs in your folder. Change "Textgrid extension" to "Textgrid". For "Task", select "Process all sounds without pause". In "Fo analysis options" or "Formant analysis options", select the appropriate parameters (or leave at default if you are not sure). Note that "N. normalised times per interval" determines how many evenly-spaced points you want to sample in each interval. If you put in "10", then each token will have 10 measurement points at 10%, 20% ... 90% 100% time.
- After you are done with the setting, continue by pressing "enter".
- A lot of files will be generated in the folder. Don't rush to see them yet. Repeat the last two steps again, except this time For "Task", you select "Get emsemble files".
- Now you can go back to the folder and open the textfiles generated to explore various types of outputs. All the generated files are text files, including those without an extension. You can add .txt to those without to access them.
- Below you can see a video of me going through these steps.
A screencast of basic ProsodyPro operations
Common causes of problems in running Praat Scripts
- Version: You do not have the latest version of Praat. Older Praat scritps generally run on new versions of Praat, but not often vice versa. Solution: download the newest version.
- Capitalisation: Your sound file extensions may be capitalised (or not). Solution: change "WAV" to "wav", or vice versa, depending on the script (search the script for "wav" and see if it's written in capital letters).
- Directory: You filled in the wrong directory when prompted to input it. Solution: place script in same folder as the sounds/textgrids, then use "./" as the directory.
- Windows/Mac incompatibility on slashes: Filepaths on Windows/Mac are formatted differently. Solution: On Mac, make sure you use "/" to write your path. On windows, use "\" instead. Notably, all my scripts are written and tested on Mac.
- Sampling rates: When pasting/creating sound combinations, your sound files have different sample rates or different number of channels. Solution: Find scripts below which resample all files to the same rate and convert multi-channel sounds into mono sounds.
- Filepath space: your directory address contains folders which contain space in their names. Solution: fill the space with "_" or place script in same folder as the sounds/textgrids, then use "./" as the directory.