Learn R Programming

seewave (version 2.2.3)

ceps: Cepstrum or real cepstrum

Description

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

Usage

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

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).

Arguments

wave

an R object.

f

sampling frequency of wave (in Hz). Does not need to be specified if embedded in wave.

channel

channel of the R object, by default left channel (1).

phase

if TRUE than the phase is taken into account in the computation of the cepstrum.

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).

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.

plot

logical, if TRUE plots the cepstrum.

qlab

title of the quefrency axis (in s).

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.

Author

Jerome Sueur sueur@mnhn.fr

Warning

The argument peaks is no more available (version > 1.5.6). See the function fpeaks for peak(s) detection.

Details

The cepstrum of a time wave is the inverse Fourier transform of the logarithm of the Fourier transform. The cepstrum of a wave s is then calculated as follows:
$$C(s) = Re[FFT^{-1}(\log{(|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 coordinate. 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.
When using tidentify or tidentify, press ‘stop’ tools bar button to return values in the console.

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

Run this code
data(sheep)
par(mfrow=c(2,1))
# phase not taken into account
ceps(sheep,f=8000,at=0.4,wl=1024)
# phase taken into account
ceps(sheep,f=8000,at=0.4,wl=1024, phase=TRUE)

Run the code above in your browser using DataLab