dynspec {seewave} | 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, wl = 512, wn = "hanning", zp = 0, ovlp = 0, norm = FALSE, dB = FALSE, plot = TRUE, title = TRUE, osc = FALSE, 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 |
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). |
wn |
window name, see ftwindow (by default "hanning" ). |
zp |
zero-padding (even number of points), see Details . |
ovlp |
overlap between two successive windows (in % ). |
norm |
logical, if TRUE compute a normalised sliding spectrum. |
dB |
logical, if TRUE returns the sliding spectrum in dB
(by default FALSE ). |
plot |
logical, if TRUE plots in an ew graphics device the successive
spectra sliding along the time wave (by default TRUE ). |
title |
logical, if TRUE adds a title with the time position of the current
spectrum along the time wave. |
osc |
logical, if TRUE plots an oscillogram beneath
the sliding spectrum with a cursor showing the position of the
current spectrum (by default FALSE ). |
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 plot for details (by default "l" for lines). |
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 env . |
msmooth |
when env is not NULL ,
a vector of length 2 to smooth the amplitude envelope with a
mean sliding window. The first component is the window length
(in number of points). The second component is the overlap between
successive windows (in %). See env . |
ksmooth |
when env is not NULL ,
kernel smooth via kernel . See env . |
colspec |
colour of the sliding spectrum. |
coltitle |
if title is TRUE , colour of the title. |
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 osc is TRUE ). |
coly0 |
colour of the y=0 line (only when osc is TRUE ). |
colcursor |
colour of oscillogram cursor (only when osc is TRUE ). |
bty |
the type of box to be drawn around the oscillogram (only when osc is TRUE ). |
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.
If plot
is FALSE
, this function returns a matrix which columns
correspond to the spectra computed along the time wave.
This function is very similar to a spectrogram. See the Details
of
spectro
for some information regarding the short term Fourier
transform.
Jerome Sueur sueur@mnhn.fr and Caroline Simonis csimonis@mnhn.fr.
spectro
, spectro3D
, spec
,
fft
, oscillo
.
data(sheep) dynspec(sheep,f=8000,wl=1024,ovlp=50,osc=TRUE) dev.off()