Brief intro to Praat
Here are a few Praat Scripts that I have written. Praat scripting is fairly simple, and can really improve the praat experience in two ways:
- Make your workflow faster by automating repetitive tasks
- Make your results more consistent by automating tasks
Here a few tips to getting started with Praat scripting:
- In case you don't already know, Praat is an acoustic analysis software program. You can use it to view spectrograms of speech (and other) sounds, and make many different acoustic measurements. It also includes some basic statistics, and some routines to run basic perceptual experiments. It runs on all major computer platforms, is free, and is fairly small in size. You can download it from praat.org
- Praat has a pretty good manual, so be sure to read it, especially the part on scripting. There is also a Praat users group, where many of your questions can be answered. (Again, be sure you have read the manual and searched around a bit before asking a question to the group).
- A good way to learn is by example, which is why I am providing some scripts here.
- To try out these scripts, open Praat and select Open Praat Script from the Praat menu.
- 3 more tips that I wish someone had told me:
- Variable names cannot start with capital letters.
- Whitespace matters. Sometimes a script will not work if you have a space at the end of a line. Be careful!
- Praat has a history recording function. Every time you click your mouse, or select something from a pulldown menu, the program is recording this and saving it. You can then paste this history into a script using the script editor's Edit > Paste History function.
Example Scripts
These scripts are provided without warranty. I have tried to insert comments where appropriate, so hopefully they should be relatively easy to use. If you find any mistakes or bugs, or if you make any improvements, I would very much like to know. Please contact me at robfelty æ umich.edu
To download one script, right-click on the script name. You can also download all the scripts (along with a few helper files) as a .zip or .tar.bz2 file.
- FricFilter.praat
-
## This script performs a filter on a highlighted section of a sound object. ## The intended use is to make intervocalic consonants sound like coda consonants. ## For fricatives, the filter created starts at the midpoint of the fricative, ## at the average intensity of the fricative, and scales it down to zero ## intensity with a linear (dB) function. - VowelMeasurements.praat
-
## This script is to be used for measuring vowels. It takes a highlighted ## section of a sound object (which should be the vowel, as determined by the ## pitch tracker), and takes the following measurements: ## duration ## F1, F2, F3 in a 30ms window centered on the midpoint of the vowel ## Peak and average intensity ## Initial, Final, Peak, and average pitch ## It uses Praat's default settings for formant and pitch analysis - VowelMeasurements2.praat
-
## This script is to be used for measuring vowels. It takes a highlighted ## section of a sound object (which should be the vowel, as determined by the ## pitch tracker), and takes the following measurements: ## duration ## F1, F2, F3 in a 30ms window centered on the midpoint of the vowel ## Peak and average intensity ## Initial, Final, Peak, and average pitch ## It uses whatever pitch and formant settings the user currently has set - VowelMeasurements3.praat
-
## This script is to be used for measuring vowels. It takes a highlighted ## section of a sound object (which should be the vowel, as determined by the ## pitch tracker), and takes the following measurements: ## duration ## F1, F2, F3 in a 30ms window centered on the midpoint of the vowel ## Peak and average intensity ## Initial, Final, Peak, and average pitch ## It uses whatever pitch and formant settings the user currently has set ## and then resets the formant and pitch analysis settings to Praat's default - WriteHeader.praat
-
## this script simply writes a header line to the info window to be used with ## the VowelMeasurements script - automateRecording.praat
-
## this script reads in a wordlist, in a one stimulus per line textfile, ## and prompts a speaker to speak each word in a carrier phrase ## "say X again", it records for X seconds, then writes the sound to a file ## named according to the stimulus, plus an integer from 1 to i, which ## represents the repition number. - evaluateMeasures.praat
-
## this script displays measurements taken in Praat ## For example, say you have used the VowelMeasurements script to make some ## measurements, and you have the results in a tab delimited file. This script ## will open up each soundfile and display the measurements taken in a textgrid ## window, allowing one to easily double-check the measurements, and make any ## adjustments if necessary. The adjusted measurements will be written out to a ## separate file - makePictures.praat
-
## this script loops over a directory which contain all sound files, ## and for each file, it opens it up, makes a spectrogram, and allows ## the user to annotate it with a text grid, and the annotation is displayed ## with the spectrogram along with the intensity contour and a pitch contour ## currently, the picture is simply copied to the clipboard, but it could also ## be written to an .eps file, or the textgrid could be written to a text grid ## file, to be used for later processing - makeStimuli.praat
-
## this script accomplishes two tasks - ## 1. cut stimulus from carrier phrase and append silence ## then write to .wav file ## 2. make some basic measurements on the vowel ## The first part requires the user to highlight the portion of the sound file ## which contains the stimulus ## The second part requires the user to highlight only the vowel portion - makeStimuliFast.praat
-
## this script accomplishes two tasks - ## 1. cut stimulus from carrier phrase and append silence ## then write to .wav file ## 2. get midpoint of vowel ## The first part requires the user to highlight the portion of the sound file ## which contains the stimulus ## The second part requires the user to highlight only the vowel portion ## The script loops over a directory containing .wav files, opens each one ## displays it in a textgrid, then asks the user to select a portion of the ## sound to be cut out, and then to select the vowel, and it marks the midpoint ## of the vowel. We used this script to edit stimuli for a perceptual experiment - plotPBvowels.praat
-
## This script plots PB canonical vowels for comparison with measured ## vowels
