Plotting signal files for a single utterance

uttplot is a general function for plotting any signal file against time. This function takes two obligatory arguments: a segment list and the parameter that is to be plotted. Note that in using uttplot, the segments should always be taken from the same utterance.

For example, the sampled speech data for the second utterance can be plotted as follows:

asegs <- emu.query("demo", "msajc001", "Phonetic!=xyzzy") 
uttplot(asegs, "samples") 

Any parameter that is available for the utterance (as shown by the tracks function) can be plotted. For example, a plot of the RMS values for the first 10 segments in the segment list asegs (see above) can be plotted as follows:

uttplot(asegs[1:10,], "rms")

To plot the formant values of segments 15 to 35 in asegs:

uttplot(asegs[15:35,], "fm", zeros=T) 

Here we have used the zeros argument to inhibit the plotting of the formants in unvoiced regions of the utterance. The results of this plot are shown in Figure 11.3, “An utterance plot of the first three formants with unvoiced segments removed.”.

Figure 11.3. An utterance plot of the first three formants with unvoiced segments removed.

An utterance plot of the first three formants with unvoiced segments removed.

There are numerous additional possible arguments to uttplot. Some of these are discussed further below.

The argument zeros can be used to zero out the fundamental frequency contour when the probability of voicing (as calculated by Waves+ and stored as the prob_voice track) is less than the value of pdat, which can range from 0 to 1 (default is 0.5). For example, compare the following two plots:

uttplot(asegs[1:20,], "F0", mfrow=c(2,1)) 
uttplot(asegs[1:20,], "F0", zeros=T) 

The first of these is the F0 contour for the first 20 segments in asegs; additionally, the display is set up for 2 rows and 1 column The second is the same utterance, but with the F0 contour zeroed out when the probability of voicing is less than 0.5 (the default value of pdat).

The display can be smoothed using the Splus non-linear smoothing function smooth. Compare the following plots:

uttplot(asegs[1:20,], "F0", zeros=T, mfrow=c(2,1)) 
uttplot(asegs[1:20,], "F0", zeros=T, smoothing=T) 

The label argument can be used for interactive labelling. When label is T, the results of the interactive labelling are returned as a segment list with start times, end times, and utterance identifier. The end times are in all cases the times at which the boundaries are placed. For example, the F0 contour just considered could be labelled for pitch peaks as follows:

my.segs <- uttplot(asegs[1:30,], "F0", zeros=T, smoothing=T, label=T) 

Now place the mouse inside the graphics window, and click the left button at the desired point (e.g. on the pitch peak of the [ai] vowel). A vertical line should appear. Now enter a label at the prompt in the S-plus text window, e.g. enter H* followed by carriage return. The label should appear above the marked line. Place other marks on the remaining pitch peaks in the same way i.e. left button and then enter a label of your choice at the prompt in the S-plus text window. When you have finished, click the middle button somewhere in the graphics window. A segment list should be returned and the result will be saved in the variable my.segs:

       start       end                                              utt
H* "1155"    "1520.67"  "/home/apps/splus3.1/library/mu/dbase/msajc001"
H* "1520.67" "1989.65"  "/home/apps/splus3.1/library/mu/dbase/msajc001"
H* "1989.65" "2328.52"  "/home/apps/splus3.1/library/mu/dbase/msajc001"
H* "2328.52" "2767.25"  "/home/apps/splus3.1/library/mu/dbase/msajc001"



Note that the times at which the boundaries occur are given in column 2 (end times). Use boundplot=F if you do not wish the existing phonetic labels to be present i.e.

You can write your segment list (my.segs above) out as a Waves label file using the function waves.lab. To write the new label file to the directory /home/accounts/steve/dbase you would use the following:

waves.lab(my.segs, "/home/accounts/steve/dbase")

This will produce a file in this directory with the same basename as the original signal file (msajc001) and the extension .ilab. If you leave out the second argument the segment list will be written to the same directory as the signal file ****BROKEN BROKEN BROKEN***.

The arguments labcentre, labeltimes and labels can all be used to superimpose labels and their boundary times on an existing plot created by uttplot. For example, to superimpose the labels of the segment list just created on an uttplot display, first make two separate vectors of the labels and their times using the label and muend functions:

labs1 <- label(my.segs)
times <- muend(my.segs)

The labels can be superimposed on the same plot as before by entering:

uttplot(asegs[1:30,], "F0", labels=labs1, labeltimes=times, smoothing=T, zeros=T)

The labcentre argument places the labels between, rather than at, boundary times. In this case, the length of the times (labeltimes) has to be one greater than the length of the labels (labels). For example, suppose a time interval from t=2400 ms to t=2800 ms is labelled as an event x. The label for the event can be superimposed on the plot as follows:

uttplot(asegs[1:30,], "F0", labels="x", labeltimes=c(2400, 2800), labcentre=T, smoothing=T, zeros=T)