ifreq {seewave} | R Documentation |
This function returns the instantaneous frequency (and/or phase) of a time wave through the computation of the analytic signal (Hilbert transform).
ifreq(wave, f, phase = FALSE, threshold = NULL, plot = TRUE, xlab = "Time (s)", ylab = NULL, ylim = NULL, type = "l", ...)
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. |
phase |
if TRUE and plot is also TRUE
plots the instantaneous phase instead of the instantaneous frequency. |
threshold |
amplitude threshold for signal detection (in % ). |
plot |
logical, if TRUE plots the instantaneous frequency or phase
against time (by default TRUE ). |
xlab |
title of the x axis. |
ylab |
title of the y axis. |
ylim |
the range of y values. |
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. |
The instantaneous phase is the argument of the
analytic signal obtained throught the Hilbert transform.
The instantaneous phase is then unwrapped and derived against time to
get the instantaneous frequency.
There may be some edge effects at both start and end of the time wave.
If plot
is FALSE
, ifreq
returns a list of two components:
p |
a two-column matrix, the first column corresponding to time in seconds (x-axis) and the second column corresponding to wrapped instantaneous phase in radians (y-axis). |
f |
a two-column matrix, the first column corresponding to time in seconds (x-axis) and the second column corresponding to instantaneous frequency in kHz (y-axis). |
This function is based on the analytic signal obtained with the
Hilbert transform (seehilbert
).
The function requires the package signal.
The matrix describing the instantaneous phase has one more row than the
one describing the instantaneous frequency.
Jerome Sueur sueur@mnhn.fr
Mbu Nyamsi, R. G., Aubin, T. & Bremond, J. C. 1994 On the extraction of some time dependent parameters of an acoustic signal by means of the analytic signal concept. Its application to animal sound study. Bioacoustics, 5: 187-203.
# generate a sound with sine and linear frequency modulations a<-synth(d=1, f=8000, cf=1500, fm=c(200,10,1000)) # plot on a single graphical device the instantaneous frequency and phase op<-par(mfrow=c(2,1)) ifreq(a,f=8000,main="Instantaneous frequency") ifreq(a,f=8000,phase=TRUE,main="Instantaneous phase") par(op)