This function returns the cepstrum of a time wave allowing fundamental frequency detection.
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", ...)
an R object.
sampling frequency of wave
(in Hz). Does not need to
be specified if embedded in wave
.
channel of the R object, by default left channel (1).
if TRUE
than the phase is taken into account in
the computation of the cepstrum.
if at
is not null, length of the window for the analysis
(even number of points, by defaults = 512).
position where to compute the cepstrum (in s).
start position where to compute the cepstrum (in s).
end position to compute the cepstrum (in s).
to identify time values on the plot with the help of a cursor.
to identify frequency values on the plot with the help of a cursor.
colour of the cepstrum.
pitch size of the cepstrum.
logical, if TRUE
plots the cepstrum.
title of the quefrency axis (in s).
title of the amplitude axis.
range of quefrency axis.
range of amplitude axis.
if plot
is TRUE
, type of plot that should be drawn.
See plot
for details (by default "l" for lines).
other plot
graphical parameters.
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).
The argument peaks
is no more available
(version > 1.5.6). See the function fpeaks
for peak(s) detection.
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.
Oppenheim, A.V. and Schafer, R.W. 2004. From frequency to quefrency: a history of the cepstrum. Signal Processing Magazine IEEE, 21: 95-106.
# NOT RUN {
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