ceps {seewave}R Documentation

Cepstrum or real cepstrum

Description

This function returns the cepstrum of a time wave allowing fundamental frequency detection.

Usage

ceps(wave, f, wl = 512, at = NULL, from = NULL, to = NULL,
tpeaks = FALSE, fpeaks = FALSE, tidentify = FALSE,
fidentify = FALSE, col = "black", cex = 1,
colpeaks = "red", cexpeaks = 0.75, fontpeaks = 1, plot = TRUE,
qlab = "Quefrency (bottom: s, up: Hz)", alab = "Amplitude",
qlim = NULL, alim = NULL, type = "l", ...)

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).
at position where to compute the cepstrum (in s).
from start position where to compute the cepstrum (in s).
to end position to compute the cepstrum (in s).
tpeaks returns peaks value for a given span according to time scale (s)(see details).
fpeaks returns peaks value for a given span according to frequency scale (Hz)(see details).
tidentify to identify time values on the plot with the help of a cursor.
fidentify to identify frequency values on the plot with the help of a cursor.
col colour of the cepstrum.
cex pitch size of the cepstrum.
colpeaks colour of peaks value plotted on the cepstrum.
cexpeaks character size of peaks value plotted on the cepstrum.
fontpeaks font of peaks value plotted on the cepstrum.
plot logical, if TRUE plots the cepstrum.
qlab title of the quefrency axis.
alab title of the amplitude axis.
qlim range of quefrency axis.
alim range of amplitude axis.
type if plot is TRUE, type of plot that should be drawn. See plot for details (by default "l" for lines).
... other plot graphical parameters.

Details

The cepstrum of a time wave is the Fourier transform of the logarithm of the Fourier transform. The cepstrum of a wave s is then calcuated as follows:

C(s) = Re(invfft(log(abs(fft(s)))))


The independent variable of a cepstral graph is called the quefrency. The quefrency is a measure of time, though not in the sense of a signal in the time domain. A correspondence with the frequency domain is obtained by simply computing the reverse of the temporal x co0rdinate. For instance if a peak appears at 0.005 s, this reveals a frequency peak at 200 Hz (=1/0.005). This explain the two scales plotted when plot is TRUE.
If at, from or to are FALSE then ceps computes the cepstrum of the whole signal.
tpeaks and fpeaks setting corresponds to dimension of embed.
When using tidentify or tidentify, press ‘stop’ tools bar button to return values in the console. tpeaks and fpeaks just differ in the unit of the results.

Value

When plot is FALSE, ceps returns the cesptral profile as a two-column matrix, the first column corresponding to quefrency (x-axis) and the second corresponding to amplitude (y-axis).

Note

Cepstral analysis is mainly used in speech processing. This analysis allows to extract the fundamental frequency, see the examples.
This function is based on fft.

Author(s)

Jerome Sueur sueur@mnhn.fr and Martin Maechler maechler@stat.math.ethz.ch for peaks.

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, fund, autoc

Examples

data(sheep)
ceps(sheep,f=8000,at=0.4,wl=1024)
# peaks detection in Hertz, the fundamental is at 160 Hz.
ceps(sheep,f=8000,at=0.4,wl=1024,fpeaks=63)

[Package seewave version 1.5.0 Index]