20 March 2023

Marking segments and annotating TextGrids in Praat

Praat is a powerful acoustic analysis software application used by phoneticians, speech scientists, linguists, audiologists, and anyone interested in measuring or manipulating speech. It was created by Paul Boersma and David Weenink who are two extremely smart, and odd (in the best possible sense), language scientists. As you use Praat, you will come to realise that the interface and design decisions reflect the personalities of its creators.

Upon launching Praat, you are presented with two windows: Praat Objects and Praat Picture. I would say that 99% of time, the user immediately closes Praat Picture. Praat Objects is where the action lies. At first glance, there isn’t a lot going on: an empty Objects list, and not many buttons showing. Unlike most software apps, the command buttons available to the user change depending on the currently selected Object type. So, in order to get started, you need to load or “read in” a file. In most instances, this will be a Sound file (such as a WAV or AIFF).


To read in a sound file, click Open then Read from file… and select the file that you want to open. That file will be loaded into Praat as a Sound object and a number of command buttons will appear on the right side of the Praat Objects window.



Our task is to mark and annotate speech segments in a TextGrid. With the Sound object selected, click on the Annotate button and then To TextGrid… You should see the Sound: To TextGrid dialog box appear and the tier names field will be pre-populated with Mary John bell and you will note that bell is a point tier. Oh the wonderful conversations I’ve had with students over the years trying to explain why Mary John bell are there! Remember that like its creators, Praat is a bit weird. Mary, John and bell are not functions or keywords or special in any way. They are merely placeholders that should be deleted immediately and replaced with whatever you want to call your tier(s). In many cases, a single tier will do. Fun fact: I usually call mine t1 (an old habit back from when tier names could not begin with a number) and almost never use point tiers. 




Once you have named your tier(s) and left the point tier field blank, click OK to create the TextGrid object. Note that it has the same name as your Sound object, which is an important convention within the world of Praat as all scripts assume that Sounds and TextGrids have identical names. Also notice that when a new object is created it is automatically selected, and the command buttons in the Praat Objects window change accordingly. 




In order to segment a Sound object and add annotations it is necessary to open the Sound and TextGrid objects together in the Praat Editor. Do this by selecting both objects (for Mac use Cmd+click; for Windows use Ctrl+click) and then click on the new View & Edit command button that will appear on the right. This will open the Editor and you will see 3 panes: 

1. the acoustic waveform, or oscillogram, on top

2. the spectrogram in the middle (which will only be visible when you zoom in, more on that below)

3. the TextGrid at the bottom (it will look yellow)




Becoming familiar with working within the Praat Editor

When working with Sound and TextGrid objects, there are essentially 3 things you can do: 

1. Navigate (zoom in and out, move left and right)

2. Add and remove boundaries to a TextGrid tier  

3. Add/edit text annotations between boundaries


Navigating in the Praat Editor

Working with Sound objects in Praat requires you to zoom in so that you can make precise decisions. So, you need to get comfortable with zooming in and out, and moving left and right. 



Zooming is relatively straightforward. You can Zoom in, Zoom out, Zoom to selection, or Show all. There are 3 ways that you can access these zoom commands: by clicking on the zoom buttons in the bottom left corner of the Praat Editor window (sometimes useful), by clicking on the View menu and then selecting the desired Zoom command (not very useful, pretty slow, but useful if you’ve forgotten the keyboard shortcut), or by using the keyboard shortcuts (the best!), which are Ctrl+I = Zoom in, Ctrl+O = Zoom out, Ctrl+N = Zoom to selection, or Ctrl+A = Show all (replace Ctrl with Cmd for Mac).



Moving left or right to earlier or later sections of the Sound object can be achieved by: dragging the horizontal scrollbar at the bottom of the Praat Editor window (least accurate); using the PageUp and PageDown keys (more accurate, and quite usefu); or titling the scroll wheel of your mouse left or right (my personal favourite, especially for small moves). Hot tip: Swiping left or right with two fingers on a Mac will achieve the same thing.


Listening to audio

When working with TextGrids and Sound objects, wearing a good pair of headphones and listening to audio is a must. There are multiple ways to listen to segments of audio. When a portion of the audio is selected, the upper most bar at the bottom of the Praat Editor window will split the window into three. Clicking on one of the three portions of the bar will play only that segment (super useful; keyboard shortcut: Tab). Clicking on the middle bar will play the visible part that you can see in your window (this is often useful; keyboard shortcut: Shift+Tab). And clicking on the lower bar will play the Total duration (usually too long to be useful). You can also play audio from the menu by clicking on View then Play or stop or Play window. To my knowledge no one has ever done it this way, so do not be the first. Click on the upper most bar at the bottom of the Editor window or use Tab. 



Marking boundaries

Now that we know how to navigate and listen to audio, we need to learn how to add, manipulate, and remove boundaries so that we can add text annotations. Adding boundaries is relatively easy. The thing that can be dificult is deciding where the boundary should go. But that will depend on the the goal that you are trying to achieve. For our purposes, we are trying to segment a large audio recording into individual sentences for stimulus playback. So, we want to be quite generous when marking boundaries so as not to cut off the speaker when they are finishing their utterance. We also want to begin and end on a zero crossing to ensure a lovely, smooth listening experience for our future participants. 


Bonus: What is a zero crossing?

The waveform or oscillogram represents the movement of the microphone/speaker over time. The line down the centre, the position where the mic/speaker rests during silence, is zero. A zero crossing is the point where the waveform crosses zero. When editing audio, cutting at zero crossings will ensure a seamless onset and offset free of unpleasant audible clicks.


In the Praat Editor, you may move your cursor to the nearest zero crossing by clicking Select then Move cursor to nearest zero crossing, or by using the keyboard shortcut Cmd+0 (Mac) or Ctrl+0 (Windows).


(Back to) Adding boundaries

Now, let’s add some boundaries. Once again, there are multiple ways to do this. Once you have zoomed in and are satisfied that you have located the correct part of the sentence, you may add a boundary by performing a single click on the waveform or spectrogram, which will place your cursor at that point, and you will see a red dotted line running vertically at that location. To add a boundary, you may: click the circle at the top of the TextGrid tier; click Boundary then Add on selected tier; or press the Return/Enter key.


Annotating segments is relatively straightforward. Simply type or paste the text that you want to appear. Note that if you need to edit the text annotation, you should direct your attention to the white editable area above the waveform, near the top left of the Praat Editor window. If I had a dollar for every student who yelled at Praat because they were trying to select the text in the yellow portion on the TextGrid tier, I’d be a rich man.



Removing boundaries is relatively easy too (once you know how). Essentially, there are two things you need to do. First, make sure that the correct boundary is selected. The selected boundary is red; all others are blue. With the correct boundary selected, you may either click on Boundary then Remove, or use the keyboard shortcut (Mac: Option+Delete; Windows: Alt+Backspace).


A final (but important!) note

Praat does not autosave your work. It barely prompts you or warns you when you are going to quit and lose all your work. So, please for the love of God, make sure that you save your TextGrids as you go. Within the Praat Editor, click File then Save TextGrid as text file… (or Mac: Cmd+S; Windows Ctrl+S) to make sure that you do not lose your work.






No comments: