Objectives

  • Work with pitch and formant data of a speech utterance
  • Learn about plotting in R and how to manipulate figures
  • Generate phonetic metrics based on top-down knowledge of speech

Exercises

Let’s start by loading the data set that we saw during this week’s lecture. The data consist of measures taken from one utterance of the word “aurora”. For tutorial data, there is a shared directory located at "/shared/groups/jrole001/pals0047/data/". You can load today’s “aurora” data with the following command:

load("/shared/groups/jrole001/pals0047/data/aurora_data.Rda")

Let’s take a look at what objects have now been loaded into the workspace:

ls()
## [1] "f0"   "f1"   "f2"   "f3"   "time"

Exercise 1: pitch plotting

Start off by plotting the object f0, which are values of the fundamental frequency of the utterance. You can use the basic plot() function:

plot(f0)

To see what options are available for manipulating the plotting, use the help command ? followed by the function name:

? plot

One of the things we can do is change the type of plot that is generated. Currently we see dots/circles corresponding to the individual values. Let’s change that to a line plot by using the value 'l' for the type argument:

plot(f0, type='l')

You can also change the color (a list of color names can be found here):

plot(f0, type='l', col='red')

Go ahead and take some time to play around with some of the options available to you!

The next thing we’re going to do is change the x-axis of the plot. Currently the x-axis is shown as “Index”… what in the world does that mean?? (we’ll find out next week). What we’re really interested in is plotting how fundamental frequency changes over time. Thankfully, one of the objects appears to be just that:

time
##  [1] 0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14
## [16] 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29
## [31] 0.30 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.40 0.41 0.42 0.43 0.44
## [46] 0.45 0.46 0.47 0.48 0.49

time to think: what do these values represent?

By specifying the time object as the x-axis values, F0 values will be plotted against time points:

plot(x=time, y=f0, type='l', col='red')

But the R plotting function is pretty clever and assumes that most users may want to do something like this, so the function allows you to ignore the specifications of x= and y= as long as you have the values in the right order:

plot(time, f0, type='l', col='red')

One thing to keep in mind when making plots: if you’re making the plot for other people to see, always make sure to label your axes. Your viewer/reader/audience needs to know how to interpret the plot, so you need to tell them what is shown on each axis and also what scale is used for the axis. We can do this simply by giving some descriptions for the xlab and ylab arguments:

plot(time, f0, type='l', col='red',
     xlab="Time (s)", ylab="Fundamental frequency (Hz)")

For the final part of the exercise, generate the plot shown below. You’ll need to investigate the options available under ? plot. Notice two things: the time is no longer in seconds, but in milliseconds; and I’ve changed the width (thickness) of the line to 5.

time to think: if the time object lists time points in seconds, how can we list them in milliseconds?

Exercise 2: formant plotting

In this exercise, we’ll plot multiple lines together in one figure. To do this, use the lines() function to add a line to the existing plot. Let’s first try plotting the F1 values and then add the F2 values to the same plot:

plot(time, f1, type='l')

lines(time, f2)

Whoops, that doesn’t look good… there is only one formant track showing but there should be two!

The problem here is that the limits of the y-axis were set when the F1 values were originally plotted, and those limits didn’t change after the F2 values were added. To fix this, we need to anticipate what the range will need to be when we make the original plot.

To change the y-axis limits you need to add two values to the ylim argument: the minimum and maximum. In order to provide two values we need to concatenate them together using the c() function. For example, we can specify the minimum as 400 and the maximum as 2000 with the following code:

plot(time, f1, type='l', ylim=c(400,2000))

lines(time, f2)

Hey, they both fit now!

For the final part of the exercise, reproduce the plot below that displays F1, F2, and F3 in different colors. However, instead of specifying the y-axis limits directly, generate the limits in an algorithmic way by finding out the entire range of values across F1, F2, and F3, using the range() function.

hint #1: the c() function can take any number of input values, not just two

hint #2: the inputs to c() do not have to be individual numbers, they can be objects containing many numbers

hint #3: c() can be used directly as an argument to the range() function

Exercise 3: generating new metrics

Rhoticity

One of the acoustic markers of rhoticity across all languages is a lowered F3 (Delattre & Freeman, 1968; Hagiwara, 1995). In English /ɹ/, F2 is relatively raised as well. Thus, the distance between F3 and F2, i.e. F3-F2, is a fairly reliable metric for rhoticity in English (Boyce & Espy-Wilson, 1997).

Using this knowledge, generate the following plot, in which an increase along the y-axis indicates an increase in rhoticity. Note that the plot uses a dotted line; the line type can be set using the lty argument.

time to think: why are the y-axis values negative here? is the plot “flipped” from what you see?

Vowel raising/fronting

One formant-based measure that is often used to capture acoustic information related to speech articulation is F2-F1 (Labov et al., 2013), which has been shown to correlate more with a raising/fronting of the tongue compared to F2 alone.

Using this knowledge, generate the following plot, in which an increase along the y-axis indicates an increase in raising/fronting. Note that the plot uses a long-dashed line.

time to think: what does this signal suggest about the time-course of articulation of the word?

References

Boyce, S., & Espy-Wilson, C. Y. (1997). Coarticulatory stability in American English /r/. Journal of the Acoustical Society of America, 101(6), 3741–3753.
Delattre, P., & Freeman, D. C. (1968). A dialect study of American r’s by x-ray motion picture. Linguistics, 6(44), 29–68.
Hagiwara, R. (1995). Acoustic realizations of American /r/ as produced by women and men [Ph.D. dissertation]. University of California Los Angeles.
Labov, W., Rosenfelder, I., & Fruehwald, J. (2013). One hundred years of sound change in Philadelphia: Linear incrementation, reversal, and reanalysis. Language, 89, 30–65.