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:

  1. Make your workflow faster by automating repetitive tasks
  2. Make your results more consistent by automating tasks

Here a few tips to getting started with Praat scripting:

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.

automateRecording.praat
#### Robert Felty 
#### 2006
#### This script comes with no warranty. Use at your own risk

## 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.

#### N.B. MAKE SURE WHEN THIS SCRIPT IS STARTED THAT ANY RECORDING WINDOWS IN 
#### PRAAT ARE CLOSED 
#### ALSO MAKE SURE THAT THE OUTDIR ALREADY EXISTS
automateRecording.praat~
#### Robert Felty 
#### 2006
#### This script comes with no warranty. Use at your own risk

## 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.

#### N.B. MAKE SURE WHEN THIS SCRIPT IS STARTED THAT ANY RECORDING WINDOWS IN 
#### PRAAT ARE CLOSED 
#### ALS	O MAKE SURE THAT THE OUTDIR ALREADY EXISTS
DetectVowels.praat
#### This script takes the selected sound object, and finds all of the vowels in it
#### then it does a formant analysis on the vowel and makes a plot
#### 2006 Robert Felty
evaluateMeasures.praat
#### Robert Felty 
#### 2005
#### This script comes with no warranty. Use at your own risk

## 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

FadeIn.praat
#### Robert Felty 
#### 2005
#### This script comes with no warranty. Use at your own risk

#### This script performs a fade in on the selected part of the stimulus, starting 
#### at the beginning of the selected portion, and stops at the midpoint of the 
#### selected portion, at which point it reaches the average intensity of the 
#### selected portion.
#### It then writes out the faded in sound to a new file
FricFilter.praat
#### Robert Felty 
#### 2005
#### This script comes with no warranty. Use at your own risk

## 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.
## TODO:  tell user why script fails (e.g. if nothing is highlighted, or no 
## object is selected
 
makePictures.praat
#### Robert Felty 
#### 2006
#### This script comes with no warranty. Use at your own risk

## 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
#### Robert Felty 
#### 2005
#### This script comes with no warranty. Use at your own risk

## 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
#### Robert Felty 
#### 2005
#### This script comes with no warranty. Use at your own risk

## 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
#### Robert Felty 
#### 2006

## This script plots PB canonical vowels for comparison with measured
## vowels

RampUp.praat
#### Robert Felty 
#### 2005
#### This script comes with no warranty. Use at your own risk

#### 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.
segmentCVCs.praat
#### Robert Felty 
#### 2008
#### This script comes with no warranty. Use at your own risk

## Mark segment boundaries for CVCs
## This script loops over a directory, opening each .wav file one at a time,
## and creates a textgrid, then opens the textgrid and sound together. At this
## point, the user can add 2 points to the textgrid marking the boundaries
## between phonemes. A pause dialog box is opened (it may be hidden behind the
## textgrid window)). Clicking on continue will write the measurements to the
## specified file. The current sound object will be deleted, and the next file
## will be opened.
## 

spectralMoments.praat
#### Robert Felty 
#### 2008
#### This script comes with no warranty. Use at your own risk

## Measure spectral moments
## 
## This script loops over a directory, opening each .wav file one at a time,
## and creates a sound object, then opens it. At this
## point, the user can select a portion (a vowel or a consonant)
## to be measured. The script then creates a spectral slice with the specified
## window width centered at the midpoint of the selected region.
## Then the script measures the first 4 spectral moments of the spectral slice.
## A pause dialog box is opened (it may be hidden behind the
## textgrid window). Clicking on continue will write the measurements to the
## specified file. The current sound object and the spectrum object will be
## deleted, and the next file will be opened.

VowelMeasurements.praat
#### Robert Felty 
#### 2005
#### This script comes with no warranty. Use at your own risk

## 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
#### Robert Felty 
#### 2005
#### This script comes with no warranty. Use at your own risk

## 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
WriteHeader.praat
#### Robert Felty 
#### 2005
#### This script comes with no warranty. Use at your own risk

## this script simply writes a header line to the info window to be used with 
## the VowelMeasurements script

last modified 2009.06.21 23:42:45 EDT