Learn R Programming

seewave (version 1.4.5)

fund: Fundamental frequency track

Description

This function tracks the fundamental frequency through a short-term cepstral transform.

Usage

fund(wave, f, wl = 512, ovlp = 0, fmax, threshold = FALSE,
plot = TRUE, xlab = "Time (s)", ylab = "Frequency (kHz)",
ylim = c(0, f/2000), ...)

Arguments

wave
data describing a time wave or a Sample object generated loading a wav file with loadSample (package sound).
f
sampling frequency of wave (in Hz). Does not need to be specified if wave is a Sample object.
wl
if at is not null, length of the window for the analysis (even number of points, by defaults = 512).
ovlp
overlap between two successive windows (in %).
fmax
the maximum frequency to detect (in Hz).
threshold
amplitude threshold for signal detection (in %).
plot
logical, if TRUE plots the fundamental frequency modulations against time (by default TRUE).
xlab
title of the time axis (s).
ylab
title of the frequency axis (Hz).
ylim
the range of frequency values.
...
other plot graphical parameters.

Value

  • When plot is FALSE, a vector is returned with the fundamental frequency track in kHz.

References

Oppenheim, A.V. and Schafer, R.W. 2004. From frequency to quefrency: a history of the cepstrum. Signal Processing Magazine IEEE, 21: 95-106.

See Also

cepstro, ceps, autoc

Examples

Run this code
data(sheep)
fund(sheep,f=8000,fmax=300,type="l")
# with 50% overlap between successive sliding windows, time zoom and 
# amplitude filter (threshold)
fund(sheep,f=8000,fmax=300,type="b",ovlp=50,threshold=5,ylim=c(0,1),cex=0.5)
# overlaid on a spectrogram
spectro(sheep,f=8000,ovlp=75,zp=16,scale=FALSE,palette=rev.gray.colors.2)
par(new=TRUE)
fund(sheep,f=8000,fmax=300,type="p",pch=24,ann=FALSE,
  xaxs="i",yaxs="i",col="black",bg="red",threshold=6)

Run the code above in your browser using DataLab