part 1


The vowel plot assignment is meant to show you speech recording, forced alignment, automatic acoustic measurement, plotting, and hand correction. More information about the vowel plot assignment can be found here.

Next we are going to go through some of these steps in a way that can be scaled up and customized for your research needs. Most of what we do can be run on a phonetics lab computer or on your own computer. It’s easier to get started on a phonetics lab computer (probably over a remote connection), and there you will have access to corpora that may be too large to store on your own computer or that you don’t have permission to download.

Tip: Keep a text file on your computer to keep records of commands so you can copy and paste them and learn them. You want to be able to replicate all the steps of things you’ve done once, while you’re still learning what all the steps mean. Using a text editor like TextEdit or Notepad can be better than Word because they are less likely to do things like replace quotation marks with fancy quotes. Fancier text editors exist, such as Kate (free) and Sublime Text ($99).

Connecting to a phonetics lab computer

If you are on campus with a wired connection or connected to the wireless network ncsu or eduroam (not ncsu-guest), connecting should work as described here. If you are off campus, you will need to connect to the VPN first. In all examples, replace “phon” in with the name of a specific lab computer (ask Jeff for names).

Open a terminal window (in Mac, look for Terminal in /Applications/Utilities or search for “Terminal”; in Windows 10 and up type “cmd” in the search field and click on “Command Prompt”; for older Windows versions, you’ll need to download a program called PuTTY: see the lab computers page for that)

To open the connection enter this command (remembering to replace yourunityid and phon) and then enter your unity id password:


You will be connected to a lab computer running the linux operating system and you interact with it by entering linux commands. You should see a command prompt that looks sort of like this: yourunityid@phon:~$

You will start out in your own home directory on the specific computer you connected to. all of these computers are connected to a shared hard drive called “phon”, which is full of data and scripts for working with data, and we will spend most of our time working on phon. It has an “ENG523” directory for us to put our files in. Change to that directory using the change directory (cd) command like this:

cd /phon/ENG523

You can always get back to your home directory on the computer you’re connected to like this (if you try this, change back to ENG523 before you do the next steps):

cd ~/

From the directory /phon/ENG523, create a directory for yourself like this using the mkdir (make directory) command (use your actual unity id) and then cd into it. Note that when you are already in /phon/ENG523, you can just type “cd yourunityid” but the following cd command will work from anywhere:

mkdir yourunityid
cd /phon/ENG523/yourunityid

Use the Penn Phonetics Lab Forced Aligner (P2FA) to replicate part of the vowel plot assignment

Compared to present-day alternatives, P2FA is a simple aligner. It expects one wav file and one text file in English, and it will write the result to a textgrid file whose name you specify. To align the test files that came with P2FA, do this:

python2 /phon/p2fa/ ../files/BREY00538.wav ../files/BREY00538.txt BREY00536.TextGrid

Copy the wav file for my vowel plot recording to your directory and align it too. You can alignn any arbitrary English wav and text file in this way.

cp ../files/jeffmielke2017.wav ./
python2 /phon/p2fa/ jeffmielke2017.wav ../files/OHDARE2.txt jeffmielke2017.TextGrid

The aligner will warn you that it doesn’t recognize one of the words. So you can copy a dictionary supplement.

cp ../files/vowelplot.dict ./dict.local

Then align again as above (you don’t need to copy the wav file again). Try using up arrows before retyping the whole python2 command.

Prepare the Montreal Forced Aligner

Compared to P2FA, the Montreal Forced Aligner has more features. It supports several languages with pretrained models and it allows you to train new models for any language. It is also easier to install on your own computer.

Do these commands the first time you want to use MFA on a *particular* lab computer. First enable the aligner (say Y when prompted):

conda create -n aligner -c conda-forge montreal-forced-aligner

Set up the aligner for aligning English recordings (downloading acoustic models of English sounds, an English pronunciation dictionary, and loading our own English dictionary that includes additional words from our interviews):

conda activate aligner
mfa model download acoustic english_us_arpa
mfa model download dictionary english_us_arpa
mfa model save --name english_slaap dictionary /phon/ENG536/files/slaap_dict

Set up the aligner for Spanish:

conda activate aligner
mfa model download acoustic spanish_mfa 
mfa model download dictionary spanish_mfa

To see what other languages are supported, see the list of pretrained acoustic models and dictionaries.

This is how you exit conda:

conda deactivate

Remember that if you connect to a different phonetics lab computer in the future you will need to repeat these steps the first time you use MFA on it.

Use the Montreal Forced Aligner

P2FA expects one wav files and one txt file as input. MFA expects a directory with one or more wav files, each with a matching txt file (with all the words in it) or TextGrid file (which can have different tiers for different speakers and different intervals for different speaker turns). If you have interview1.wav and interview2.wav, you should also have either interview1.TextGrid and interview2.TextGrid or interview1.txt and interview2.txt. txt files are appropriate for short recordings of one speaker, and TextGrid files are better for longer recordings and necessary when you want to distinguish the speech of multiple speakers. TextGrid tier names will be interpreted as speaker labels. File names are just used to match up sound files with text files.

Start your aligner session:

conda activate aligner

Validate and align Jeff’s vowelplot recording (using files in /phon/ENG523/files/jeff_vowelplot). The validation step warns you if there are any problems with your corpus so that you can fix them before trying to align it:

mfa validate ../files/jeff_vowelplot english_slaap english_us_arpa
mfa align ../files/jeff_vowelplot english_slaap english_us_arpa jeff_vowelplot_output

Validate and align Jeff’s vowelplot recording (using files in /phon/ENG523/files/jeff_vowelplot):

mfa validate ../files/english_data english_slaap english_us_arpa
mfa align ../files/english_data english_slaap english_us_arpa english_data_output

Validate and align some sample Spanish speech recording (using files in /phon/ENG523/files/spanish_data):

mfa validate ../files/spanish_data spanish_mfa spanish_mfa
mfa align ../files/spanish_data spanish_mfa spanish_mfa spanish_data_output

Make measurements using one_script

Use Praat to measure the formants in that vowel plot recording you just aligned:

praat /phon/scripts/one_script.praat '/phon/ENG523/files/jeff_vowelplot/jeff.wav;/phon/ENG523/jimielke/jeff_vowelplot_output/jeff.TextGrid' 'VOWEL VL' 'formants()' 'l'

Measure spectral properties of sibilants instead of vowel formants:

praat /phon/scripts/one_script.praat '/phon/ENG523/files/jeff_vowelplot/jeff.wav;/phon/ENG523/jimielke/jeff_vowelplot_output/jeff.TextGrid' 'S SH' 'sibilant_jane()'

Measure sibilants in a fragment of the Buckeye Corpus instead of that one vowel plot recording:

praat /phon/scripts/one_script.praat '/phon/Buckeye/buckeye_test.csv' 'S SH' 'sibilant_jane()'

To list the files that are in your directory now, use the ls command:


To see some more information about these files do this:

ls -l

To see some more information about files we’ve been working with in the “files” directory, do this:

ls -l /phon/ENG523/files

Transfer files between a phonetics lab computer and your computer

When you create files remotely on the phonetics lab computer, you are limited in how you can interact with them. After you make measurements, you will probably want to download your files. To copy files between local and remote computers, open a NEW terminal window on your computer (the same way you did above). Importantly, do NOT use ssh to connect to the remote (phonetics lab) computer. You will be issuing these commands to YOUR OWN computer.

The command scp (secure copy) takes two arguments: where to find the file you want to copy and where to put. For downloads, we have to specify the remote computer and username in the first argument. To download the textgrid you created by aligning with P2FA, do this (with the usual changes):

scp ./

To download the textgrid you created by aligning with MFA, do the same thing but specify a different file location and filename:

scp ./

The “./” at the end tells it to put the file in your current directory. If you wanted to specify a different directory you can change “./” to something like “/Users/jimielke/Documents” “C:\Users\jimielke\Documents”.

Uploading works similarly. First let’s create a file to upload. Open your text editor and a make a file with one line containing the text “THARP’S TH AA1 R P S” without the quotes and save it as dict.txt.

The scp command for uploading specifies the remote computer and username for the destination. This will work if your dict.txt is in your current directory in the terminal:

scp dict.txt

Note that in this example we are also renaming dict.txt to dict.local. If we left out the “dict.local” part at the end it would simply be uploaded as dict.txt. If dict.txt is not found, you can do things like change the source file from dict.txt to “/Users/jimielke/Documents/dict.txt” “C:\Users\jimielke\Documents\dict.txt” or else use the cd command to get into /Users/jimielke/Documents or C:\Users\jimielke\Documents.

Continue to part 2.