Representing and plotting a distance in F1/F2 graph, in terms of the Euclidean distance, is relatively easy in R. This post shows one of the ways of achieving that. First, we provide a sample data, which consists of F1 and F2 values for two diphthong targets. Then, draw the diphthong positions with their starting and ending targets, and, finally, calculate the distance. This R code does most of the F1/F2 calculations and drawing.

## Data sample (Formants in a Diphthong)

First, a data sample.

ESLStudents ascii ipa f1 f2 1 aw_l_1 ɑʊl_1 900.96 1600.10 2 aw_l_2 ɑʊl_2 373.61 1082.59 RPSpeaker ascii ipa f1 f2 1 aw_l_1 ɑʊl_1 823.07 1542.39 2 aw_l_2 ɑʊl_2 411.39 1405.78

These are the values for the first two formants in /ɑʊ/, as measured in a group of 15 female ESL student and one RP speaker (also female). Number 1 in the notation marks the first vowel target, 2 the second (thus, aw_l_1 is /ɑ/ and aw_l_2 is /ʊ/), while the “l” marks a long diphthong. The two targets will be the starting and the ending of a line, and the line’s length is expressed by the Euclidean distance.

## The Euclidean Distance

Euclidean distance is a metric distance from point A to point B in a Cartesian system, and it is derived from the Pythagorean Theorem. Thus, if a point *p* has the coordinates *(p1, p2)* and the point *q = (q1, q2)*, the distance between them is calculated using this formula:

distance <- sqrt((x1-x2)^2+(y1-y2)^2)

Our Cartesian coordinate system is defined by F2 and F1 axes (where F1 is y-axis), and the metric distance refers to the distance from one diphthong target to another. The vowel targets, corresponding to A and B points are defined by the F1/F2 values in Hertz for a particular vowel. In our example above, A and B are rows 1 and 2, while the values are F2 and F1 frequencies.

## Plotting in R

The third step in the process is plotting, so we could see the graphical representation of the distance. We can do that by:

- Drawing the F1/F2 “coordinate system”.
- Drawing the vowels in A and B positions, and connecting them with a line.
- Drawing the arrows showing the direction of pronunciation and placing the IPA symbols.

RPSpeaker ESLStudents aw_l ɑʊl 738.86 433.75 aw_s ɑʊs 816.08 471.60

## 6 replies on “The Euclidean Distance in Diphthongs – R Graph and Code”

[…] the sources for the above, visit Books & References page. You can also read a discussion about drawing a diphthong by using its formant frequencies (and calculating the Euclidean […]

Dear all,

How could we modify the script to add a third measurement point? Namely, at 25%, 50% and 75% of the vowel duration?

Thank you ever so much,

Maelle

Yes, of course 🙂 It’s a code/script and very easy to modify.

Hello

thanks for your post. It is really interesting.

I have a question. What was your criteria of dividing a diphthong into two vowels. For example, you mentioned

/ɑʊ/. What was your criteria of dividing /ɑ/ from /ʊ/? Did you manually, looking spectrum and formants and hearing sound file, divide each vowel from each speakers?

Thanks a lot!

Kim

Hello, Kim. That is an excellent question. When I asked my mentor the same thing she said that I should devise my own methodology and be consistent. This is how I approched the segmentation issue: http://www.languagebits.com/files/segmentation.pdf

[…] and learn new techniques. I have experienced that and I loved it when I had to learn the basics of R programming; now I am looking forward to the same excitement in Java. Learning a new programming language (a […]