Click here for the materials from a Praat scripting tutorial I did for the IU Second Language Psycholinguistics Lab in 2019. Although I made them to accompany a live presentation, the explanations on the slides and the sample scripts may still be useful for you.
In addition, here are some Praat scripts that I've written or modified:
Concatenate sound pairs from table
This script concatenates pairs of sound files with a pause between according to rows of file names in a tab-separated text file. Each sound pair should have the two sound file names (minus .wav) specified in order in the first two columns, with the name given to the concatenated sound file in the third column. Make sure to include a header for each column, since Praat reads in the first row of a table as the header. Pause duration is specified in seconds by the user. This is useful for creating stimuli for AX experiments, particularly for jsPsych.
Concatenate sound triads from table
This script concatenates groups of three sound files with pauses according to rows of file names in a tab-separated text file. Each sound triad should have the three sound file names (minus .wav) specified in order in the first three columns, with the name given to the concatenated sound file in the fourth column. Make sure to include a header for each column, since Praat reads in the first row of a table as the header. Pause duration is specified in seconds by the user. This is useful for creating stimuli for ABX or oddity experiments, particularly for jsPsych.
Concatenate four sounds from table
This script concatenates groups of four sound files with pauses according to rows of file names in a tab-separated text file. Each sequence of four sounds should have the four sound file names (minus .wav) specified in order in the first four columns, with the name given to the concatenated sound file in the fifth column. Make sure to include a header for each column, since Praat reads in the first row of a table as the header. Pause duration is specified in seconds by the user. This is useful for creating stimuli for 4AFC experiments, particularly for jsPsych.
Add points and labels from table
This script creates a TextGrid with a point tier and adds points and labels according to the file name, timepoints, and labels indicated in a tab-separated text file. It will run through all files specified in the text file as long as they are within the same folder. Put the name of the sound file in the first column (minus .wav), the timepoint in the second column, and the label in the third column. Make sure to include a header for each column, since Praat reads in the first row of a table as the header.
Make pairs of identical sounds with pause
This script reads in all files in a folder and concatenates each one with itself with a pause in between. An optional prefix for concatenated files and the pause duration in seconds are specified by the user. This can be helpful if you want all of your stimuli to be played twice during a trial. For example, we have used this script to create stimuli for an auditory word familiarity task.
Move left boundary of labeled intervals to the left and zero cross final boundaries
This script moves the left boundary of labeled intervals to the left (earlier in the sound file) by a specified duration in milliseconds and moves the final left and right boundaries to the closest zero crossings. This is useful in creating a precise duration before the beginning of a sound when cutting stimuli.
Move left boundary of labeled intervals to the right and zero cross final boundaries
This script moves the left boundary of labeled intervals to the right (later in the sound file) by a specified duration in milliseconds and moves the final left and right boundaries to the closest zero crossings. This is helpful when, like me, you use the script that moves the left boundaries to the left and then realize you forgot to label certain stimuli, so you want to undo it.
Move right boundary of labeled intervals to the right and zero cross final boundaries
This script moves the right boundary of labeled intervals to the right (later in the sound file) by a specified duration in milliseconds and moves the final left and right boundaries to the closest zero crossings.
Add silence to the beginning of all sound files in a folder
This script adds a specified amount of silence to the beginning of every sound file in a folder. The resulting sound files are saved with their original names to a folder specified by the user.
Add silence to the end of all sound files in a folder
This script adds a specified amount of silence to the end of every sound file in a folder. The resulting sound files are saved with their original names to a folder specified by the user. We have used this script to add silence to stimuli we were presenting in Qualtrics, since this software sometimes clips the end of sound files.
Get F1 to F4 at 7 times points for all labeled intervals
This script extracts measurements for F1, F2, F3, and F4 at 7 equidistant times points (25%, 37.5%, 50%, 62.5%, 75%, 87.5%, and 100%) in all labeled intervals. It processes all labeled intervals for all sound files in a folder, and outputs a text file. Each sound file and its corresponding TextGrid should have the same name.
Get duration and timepoints for all labeled intervals or points on specified tiers for all files in a folder
This script logs the starting point, end point, and duration of labeled intervals in a specified interval tier and/or the timepoint of labeled points in a specified point tier for all files in a folder. You can specify up to one interval tier and one point tier. Each sound file and its corresponding TextGrid should have the same name.
Pull out words found in text file from one tier and put on additional tier
This script takes a list of words in a text file as input. This text file should have a header row (although the name is irrelevant), and all the words in a single column. For all files in a folder, it then searches a specified tier in the TextGrids for those words, and copies them into a new interval tier at the bottom of the TextGrids at the same time points that they appear in the tier above. This is useful if you want to pull out specific words (or any other kind of label) from one tier to run analyses on in a separate tier.
Find words in a tier and replace corresponding interval label on other specified tier
This script takes a list of words in a text file as input. This text file should have a header row (although the name is irrelevant), and all the words in a single column. For all files in a folder, it then searches a specified tier in the TextGrids for those words, and once it finds one, it replaces the interval label at the same time point in a different tier with the label that the user specified. This is useful if you want to find all instances of filled pauses in an orthography tier and then remove or replace the label for them in a separate analysis tier.
Save labeled intervals to WAV files
This script saves each interval in the selected interval tier of a TextGrid to a separate WAV sound file. The source sound must be opened as a LongSound object, and both the TextGrid and the LongSound must have identical names and they have to be selected in the Objects window before running the script. The original script is by Mietta Lennes and I have modified it only slightly so that it automatically ignores all empty intervals, intervals with a space, or intervals with a line break, because I was always having to find and delete extraneous spaces or line breaks in otherwise empty labels before the script would run all the way through.
Save labeled intervals to WAV files for all files in a folder
This script saves all labeled intervals as individual WAV sound files for a specified TextGrid tier for all files in a given folder. Like the previous script, this one also automatically ignores all empty intervals, intervals with a space, or intervals with a line break.
In addition, here are some Praat scripts that I've written or modified:
Concatenate sound pairs from table
This script concatenates pairs of sound files with a pause between according to rows of file names in a tab-separated text file. Each sound pair should have the two sound file names (minus .wav) specified in order in the first two columns, with the name given to the concatenated sound file in the third column. Make sure to include a header for each column, since Praat reads in the first row of a table as the header. Pause duration is specified in seconds by the user. This is useful for creating stimuli for AX experiments, particularly for jsPsych.
Concatenate sound triads from table
This script concatenates groups of three sound files with pauses according to rows of file names in a tab-separated text file. Each sound triad should have the three sound file names (minus .wav) specified in order in the first three columns, with the name given to the concatenated sound file in the fourth column. Make sure to include a header for each column, since Praat reads in the first row of a table as the header. Pause duration is specified in seconds by the user. This is useful for creating stimuli for ABX or oddity experiments, particularly for jsPsych.
Concatenate four sounds from table
This script concatenates groups of four sound files with pauses according to rows of file names in a tab-separated text file. Each sequence of four sounds should have the four sound file names (minus .wav) specified in order in the first four columns, with the name given to the concatenated sound file in the fifth column. Make sure to include a header for each column, since Praat reads in the first row of a table as the header. Pause duration is specified in seconds by the user. This is useful for creating stimuli for 4AFC experiments, particularly for jsPsych.
Add points and labels from table
This script creates a TextGrid with a point tier and adds points and labels according to the file name, timepoints, and labels indicated in a tab-separated text file. It will run through all files specified in the text file as long as they are within the same folder. Put the name of the sound file in the first column (minus .wav), the timepoint in the second column, and the label in the third column. Make sure to include a header for each column, since Praat reads in the first row of a table as the header.
Make pairs of identical sounds with pause
This script reads in all files in a folder and concatenates each one with itself with a pause in between. An optional prefix for concatenated files and the pause duration in seconds are specified by the user. This can be helpful if you want all of your stimuli to be played twice during a trial. For example, we have used this script to create stimuli for an auditory word familiarity task.
Move left boundary of labeled intervals to the left and zero cross final boundaries
This script moves the left boundary of labeled intervals to the left (earlier in the sound file) by a specified duration in milliseconds and moves the final left and right boundaries to the closest zero crossings. This is useful in creating a precise duration before the beginning of a sound when cutting stimuli.
Move left boundary of labeled intervals to the right and zero cross final boundaries
This script moves the left boundary of labeled intervals to the right (later in the sound file) by a specified duration in milliseconds and moves the final left and right boundaries to the closest zero crossings. This is helpful when, like me, you use the script that moves the left boundaries to the left and then realize you forgot to label certain stimuli, so you want to undo it.
Move right boundary of labeled intervals to the right and zero cross final boundaries
This script moves the right boundary of labeled intervals to the right (later in the sound file) by a specified duration in milliseconds and moves the final left and right boundaries to the closest zero crossings.
Add silence to the beginning of all sound files in a folder
This script adds a specified amount of silence to the beginning of every sound file in a folder. The resulting sound files are saved with their original names to a folder specified by the user.
Add silence to the end of all sound files in a folder
This script adds a specified amount of silence to the end of every sound file in a folder. The resulting sound files are saved with their original names to a folder specified by the user. We have used this script to add silence to stimuli we were presenting in Qualtrics, since this software sometimes clips the end of sound files.
Get F1 to F4 at 7 times points for all labeled intervals
This script extracts measurements for F1, F2, F3, and F4 at 7 equidistant times points (25%, 37.5%, 50%, 62.5%, 75%, 87.5%, and 100%) in all labeled intervals. It processes all labeled intervals for all sound files in a folder, and outputs a text file. Each sound file and its corresponding TextGrid should have the same name.
Get duration and timepoints for all labeled intervals or points on specified tiers for all files in a folder
This script logs the starting point, end point, and duration of labeled intervals in a specified interval tier and/or the timepoint of labeled points in a specified point tier for all files in a folder. You can specify up to one interval tier and one point tier. Each sound file and its corresponding TextGrid should have the same name.
Pull out words found in text file from one tier and put on additional tier
This script takes a list of words in a text file as input. This text file should have a header row (although the name is irrelevant), and all the words in a single column. For all files in a folder, it then searches a specified tier in the TextGrids for those words, and copies them into a new interval tier at the bottom of the TextGrids at the same time points that they appear in the tier above. This is useful if you want to pull out specific words (or any other kind of label) from one tier to run analyses on in a separate tier.
Find words in a tier and replace corresponding interval label on other specified tier
This script takes a list of words in a text file as input. This text file should have a header row (although the name is irrelevant), and all the words in a single column. For all files in a folder, it then searches a specified tier in the TextGrids for those words, and once it finds one, it replaces the interval label at the same time point in a different tier with the label that the user specified. This is useful if you want to find all instances of filled pauses in an orthography tier and then remove or replace the label for them in a separate analysis tier.
Save labeled intervals to WAV files
This script saves each interval in the selected interval tier of a TextGrid to a separate WAV sound file. The source sound must be opened as a LongSound object, and both the TextGrid and the LongSound must have identical names and they have to be selected in the Objects window before running the script. The original script is by Mietta Lennes and I have modified it only slightly so that it automatically ignores all empty intervals, intervals with a space, or intervals with a line break, because I was always having to find and delete extraneous spaces or line breaks in otherwise empty labels before the script would run all the way through.
Save labeled intervals to WAV files for all files in a folder
This script saves all labeled intervals as individual WAV sound files for a specified TextGrid tier for all files in a given folder. Like the previous script, this one also automatically ignores all empty intervals, intervals with a space, or intervals with a line break.