Learn R Programming

phonTools (version 0.2-2.0)

formanttrack: Formant Tracking

Description

Create a formant track for a sound.

Usage

formanttrack (sound, timestep = 5, windowlength = 30, 
formants = 5, cutoff = 5000, minformant = 200, maxbw = 600, 
fs = 22050, show = TRUE, periodicity = .5)

Arguments

sound
A numeric vector representing a waveform, or a 'sound' object created with the loadsound() or makesound() functions.
timestep
How far the analysis window will advance, in milliseconds. If this value is set to zero, the function is applied to the entire signal.
windowlength
The length of the analysis window. Longer windows will result in increased accuracy with decreased time-resolution.
formants
The desired number of formants to be tracked. Depending on the sound and time point, fewer than this many may be found.
cutoff
The maximum analysis frequency. May not be higher than the Nyquist frequency.
minformant
Formants below this frequency are rejected.
maxbw
The maximum bandwidth for accepted formants.
fs
The sampling frequency of the sound. If a 'sound' or 'ts' object is passed, this does not need to be specified.
show
If TRUE, a plot is created which allows the user to visually inspect the process.
periodicity
A value between 0 and 1. Signal sections with corrected ACF values lower than this are not analyzed. Allows voiceless sections to be excluded from analysis.

Value

  • A dataframe with the following elements is returned:
  • timeThe time, in milliseconds, of the middle of the analysis window.
  • f#The formant frequency for formant number #, one column for each formant.

Details

This function works by repeatedly calling findformants(), and periodicity is established using pitchtrack(), both of which are included in this package. When no formants are found, or if less than the desired number of formants are found, a value of zero is returned for that formant, at that time point. Tracked formants are presented over a greyscale spectrogram if show is TRUE. When plotting, different colors are used for each formant to allow the user to distinguish these.

Examples

Run this code
data (sound)

par (mfrow = c(2,1), mar = c(4,4,1,1))
formanttrack (sound)
formanttrack (sound, periodicity = 0)

Run the code above in your browser using DataLab