The main interface between the Emu system and Splus is via two functions which perform a database query and extract data corresponding to a set of segments or events. These functions are emu.query which executes a query on the database and returns a segment list containing the start and end times of matching segments or events, and emu.track which takes a segment list and returns the corresponding time-series data for each segment. An example of the use of these functions is as follows:
vowels.seg _ emu.query("demo", "*", "Phonetic=vowel")
vowels.fm _ emu.track(vowels.seg, "fm")
|
In this example, the database is first queried for segments in the vowel category, the resulting segment list is saved in the variable vowels.seg. Formant data (the fm track) is then extracted for each segment and saved in the variable vowels.fm. The result of the emu.track command is an object of class trackdata which contains the data for each segment, this can then be plotted or analysed further using a number of functions included with Emu/Splus.
emu.track can also be used to extract data at a single time point for each segment or for events, which have only a single time. In this case the result is a matrix of data with one row for each segment a number of columns defined by the width of the data being extracted. If the segment list corresponds to events, data will be automatically extracted for the single time point; if they are segments then the cut argument can be used to specify a cut point as a proportion (in the range 0.0 to 1.0) of the segment duration. Here is an example which extracts formant data at the vowel midpoint and at the vowel Target:
vowels.seg _ emu.query("demo", "*", "Phonetic=vowel")
vowels.trg _ emu.query("demo", "*", "Target=vowel")
vowels.trg.fm _ emu.track(vowels.trg, "fm")
vowels.mid.fm _ emu.track(vowels.seg, "fm", cut=0.5)
|
This data could then be used to produce comparative plots of the vowel formants as measured at the midpoint and the vowel target:
par(mfrow=c(1,2)) # get two plots side by side
eplot(vowels.trg.fm, label(vowels.trg), formant=T, centroid=T)
eplot(vowels.mid.fm, label(vowels.seg), formant=T, centroid=T)
|
Duration values can be derived from the start and end times in a segment list with the mudur function. These values can be used in statistical analysis or plotted, for example with the nplot function which fits a normal curve to each class of segments:
nplot(mudur(vowels.seg), label(vowels.seg), xlab="Vowel Duration (ms)")
|