dynspec | R Documentation |
This function plots dynamically a sliding spectrum along a time wave. This basically corresponds to a short-term Fourier transform.
dynspec(wave, f, channel = 1, wl = 512, wn = "hanning", zp = 0,
ovlp = 0, fftw = FALSE, norm = FALSE, dB = NULL, dBref = NULL, plot = TRUE,
title = TRUE, osc = FALSE,
tlab = "Time (s)", flab = "Frequency (kHz)",
alab = "Amplitude", alim = NULL, flim = c(0, f/2000),
type = "l", from = NULL, to = NULL, envt = NULL,
msmooth = NULL, ksmooth = NULL, colspec = "black",
coltitle = "black", colbg = "white", colline = "black",
colaxis = "black", collab = "black", cexlab = 1,
fontlab = 1, colwave = "black",
coly0 = "lightgrey", colcursor = "red", bty = "l")
wave |
an R object. |
f |
sampling frequency of |
channel |
channel of the R object, by default left channel (1). |
wl |
if |
wn |
window name, see |
zp |
zero-padding (even number of points), see |
ovlp |
overlap between two successive windows (in % ). |
fftw |
if |
norm |
logical, if |
dB |
a character string specifying the type dB to return: "max0" for a maximum dB value at 0, "A", "B", "C", "D", and "ITU" for common dB weights. |
dBref |
a dB reference value when |
plot |
logical, if |
title |
logical, if |
osc |
logical, if |
tlab |
title of the time axis. |
flab |
title of the frequency axis. |
alab |
title of the amplitude axis. |
flim |
range of frequency axis. |
alim |
range of amplitude axis. |
type |
type of plot that should be drawn for the sliding spectrum.
See |
from |
start mark where to compute the sliding spectrum (in s). |
to |
end mark where to compute the sliding spectrum (in s). |
envt |
the type of envelope to be plooted:
either "abs" for absolute amplitude envelope or "hil" for Hilbert amplitude envelope.
See |
msmooth |
when |
ksmooth |
when |
colspec |
colour of the sliding spectrum. |
coltitle |
if |
colbg |
background colour. |
colline |
colour of axes line. |
colaxis |
colour of the axes. |
collab |
colour of axes title. |
cexlab |
character size for axes title. |
fontlab |
font for axes title. |
colwave |
colour of the oscillogram or of the envelope (only when |
coly0 |
colour of the y=0 line (only when |
colcursor |
colour of oscillogram cursor (only when |
bty |
the type of box to be drawn around the oscillogram (only
when |
Use the slider panel to move along the time wave.
Use the argument norm
if you wish to have each spectrum normalised, i.e.
with values between 0 and 1 or maximised to 0 dB when dB
is TRUE
.
The function requires the package rpanel that is based on the package tcltk.
This function returns a list of three items:
time |
a numeric vector corresponding to the time axis. |
freq |
a numeric vector corresponding to the frequency axis. |
amp |
a numeric matrix corresponding to the amplitude values.
Each column is a Fourier transform of length |
This function is very similar to a spectrogram. See the Details
of
spectro
for some information regarding the short term Fourier
transform.
Jerome Sueur and Caroline Simonis
spectro
, spectro3D
,
wf
, spec
, dynspectro
,
fft
, oscillo
, env
.
## Not run:
data(sheep)
require(rpanel)
dynspec(sheep,f=8000,wl=1024,ovlp=50,osc=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.