Praat Code

Praat (Boersma & Weenik, 2018) is one of the best computer programs for acoustic-phonetic analysis and manipulation of sound stimuli (and it’s free!). In addition to a GUI, you can write custom code.

Here are a few useful Praat scripts I’ve written / adapted from others. For a full list, see my Github: https://github.com/michellecohn/praat-scripts/

Loading / saving into Praat

Load in all .wav files

Load in all .wav files / associated TextGrids

Save all .wav and/or .TextGrid files to a directory

Converting

Convert all files to mono

Convert to stereo

Convert to short Text Grid

Resample all files & combine with other sound

Adjusting acoustic properties

Change mean intensity of all files

Match intensity contour of another sound

Match vowel duration of another sound

Match mean dB of another vowel

Match f0, intensity, & duration of another sound (combined script)

Create duration continuum

New monotone f0 for the whole sound

New monotone f0 for selected vowels

New mean f0 for sounds from a list (.txt file)

Pull in all .mp3 files (options to amplitude normalize, resample) and save as .wav files

Adding silence

Pad beginning of the sound with silence

Pad end of soundfile so that total duration is the same value (e.g., 900 ms)

Concatenate sounds with a pause

Add buffer to soundfile AND shift textgrid accordingly (currently adds 1/2 total duration to beginning)

Adding noise

Pad end of sound with 1 second of white noise (can adjust duration and intensity of noise)

Speed up or slow down a soundfile + textgrid

Multiply soundfile and textgrid by a duration factor

Speed up / slow down textgrid (e.g. from MFA output) to match original soundfile

Annotations

At each “sp”, label separate sentence interval (e.g., from FAVE align output)

Get sentence from labeled word intervals (assumes you have (unlabeled) sentences in separate intervals)

Measurements

Get intensity, duration, & mean f0 over 12 points of the vowel (Adapted from Christian DiCanio)

Get duration measurements for each annotated word

Get duration of vowel and coda for each word

Combining sounds

Concatenate 2 sounds (1 sound == frame)

Concatenate all sounds in a directory

Resample all files & combine with other sound

Extract & save all sounds

… from a force aligned file (finding “sp”s) and numbering sentences

Split individual sounds from a word and save to directory

Writing to .txt file

Extract info before underscore (to command window)

Concatenating for FAVE align

Open all files in a directory & concatenate them, saving a .txt file transcript