17 September 2011

Do you have a Praat script that can...

As I have mentioned before, Praat scripts can take care of many repetitive actions for you, saving you many mouse clicks. But be warned, a script cannot do anything that requires human judgment, such as labeling segments. I cannot stress this enough: you have to know exactly what the script is doing.

When I first started using Praat, I used many small scripts, each of which performed one small job. For instance, after a recording session, I would use one script to cut the large file of the entire recording session into smaller files, a separate script to extract measurements, another script to normalise the intensity of the sounds, and yet another script to ramp in and out, and so on. What I found was that the problem with such an approach is that it is very easy to lose track of what manipulations you have already done to a set of sound files — especially if you are working on multiple projects at the same time, with different normalisation scripts, etc. As a result, a few years ago, I changed the way that I used Praat scripts.

Now, for each project, I create one large Praat script that contains all manipulations: taking original measurements, manipulating intensity, pitch, ramping, etc., renaming files, and taking new measurements after all manipulations have been completed. This way, when the time comes to write up the Method section, all of the information is easily accessible and traceable.

Due to this new project-based scripting technique, I create a new script for each project that I am working on. However, I rarely code a script from scratch. Bits and pieces can be reused from other scripts, and in this way new scripts can be generated very quickly. Below, I have listed all of the Praat scripts that I have in my possession. I receive frequent requests along the lines of, "Do you have a script that does x?"

Every Praat script that I have is listed below, along with a brief description. I have omitted some scripts that are very similar to those posted here, or some of the larger scripts that have been tailored to a particular set of stimuli. Each script may be downloaded by clicking on the name. Please feel free to download, modify, and redistribute the scripts without restriction. What's mine is yours:

text grid maker.praat My first ever Praat script. Very useful for creating textgrids once a recording has been completed. Saves you many mouseclicks and RSI.

text grid reviewer.praat Once you (or a research assistant) have created textgrids, it can be useful to open each sound file and its corresponding textgrid to review the boudnaries and annotations that have been created. This script makes the reviewing process easy. It allows you to make edits and saves the changes before moving to the next textgrid.

duration logger.praat Useful for measuring the length of intervals marked in a textgrid. Bits of this script show up in all of my larger scripts that have the word "measure" in their filename.

wav aif converter.praat A simple, but very useful script for those who wish to share soundfiles between Macs and PCs. Wav files can be easily converted to aiff and vice versa without altering the file's quality.

get measurements.praat Similar to duration logger.praat except that this script outputs a range of measurements: formants, f0, amplitude at 25, 50 and 75% of each vowel.

load all sound files.praat A very simple, but very useful script. It loads all soundfiles in a directory into Praat. Praat annoyingly does not function like most Windows/OSX apps. You cannot drag and drop a file into Praat. Opening many files is a bit of a chore. Newer versions of Praat at least let you open multiple files at once. This script makes things even easier. I always include a version of this script when asking others to listen to a bunch of sound files for me. It just makes life easier. highly recommended.

token selection.praat Very similar to load all sound files.praat above. Option may be enabled for soundfiles to being playing when script is run.

sound chainer.praat Combines all files in a directory into a single file, adding 1 second of silence between each sound.

on off ramp.praat Quick and easy way to ramp many files that have already been cut.

chop from point.praat Reads in all sounds and textgrids in a directory, identifies which parts of the original sound have been labelled, extracts the labelled sound, ramps the beginning and end of the sound, outputs newly cut sounds, and preserves textgrids.

ramp, chop - preserve textgrids.praat One of my first 'larger' scripts. As the name implies, it excises individual tokens from a larger file, ramps the onset and offset to zero dB, and preserves the textgrid information for the excised segment.

norm, ramp, chop - preserve textgrids.praat Similar to the script above, except that it normalises each token as well as ramp in and out.

chop, measure, preserve textgrids.praat No ramping or scaling in this version of the script.

chop, measure, scale intensity, fix duration.praat Similar to other scripts listed here except that all tokens are fixed to a set duration by calculating and adding x amount of silence to the end of each sound. Useful for experiments that require regular presentation of simuli, such as one sound each second, as might occur in fMRI.

scale intensity (energy) with output.praat Reads in soundfiles, takes intensity measurements, scales each file to a specified dB value, takes new intensity measurements. An error message is displayed if any sounds clip due to scaling.

scale peak steps.praat Outputs a variety of acoustic measurements. Calculates the difference between the intensity of the vowel and a prespecified intensity (dB_target). Scales the entire soundfile so that the vowel's intensity will now equal dB_target. Outputs a new set of acoustic measurements, this time for the scaled stimuli.

pitch fixer.praat Sets the pitch of each token to a predetermined (flat) value.

sound mixer, step maker.praat Generates a continuum of x steps between two soundfiles that serve as  endpoints. The continuum is created by mixing the two sounds together.

create Klatt sound.praat Synthesises the syllable /da/ using Klatt synthesis.

Michael_Klatt_cont_plusplot_2d.praat This impressive script was developed by one of my previous supervisors, Michael Tyler. The script takes as its input two vowels defined in F1/F2 space. One is an anchor and the other a starting point. The script will generate a continuum of vowels at a given distance apart (in erbs) at a fixed radius from the anchor vowel. The user can choose this to be the distance between the anchor vowel and the starting point or the user provides a radius in erbs.  The user specifies whether the direction is anticlockwise or clockwise. Most people won't find much use for this, but it is very advanced stuff.

I will continue adding to the list as I develop new scripts, or come across scripts that I consider to be useful.

09 September 2011

Brand new look to celebrate Mark's Speechblog's 4th birthday

My Speechblog turned 4 on September 9, and to celebrate, I have created an all new blog template. I am using a heavily modified version of the 'Ethereal' Blogger template. The text area of each post has been widened to take advantage of the widescreen aspect ratio of most monitors, tablets and smart phones. The header logo has also been updated. I'm a lot better at manipulating images now than I was when I created the original speech signal header in 2007. For those interested in speechy things, the new waveform is of a Spanish female speaker producing a trill in /aCa/ context - only the first vowel and part of the trill are visible in the header. A bit of trivia for you: the old waveform was of a Ma'di voiced implosive stop.