Learn R Programming

seewave (version 2.1.8)

dynspectro: Dynamic sliding spectrogramn

Description

This function plots dynamically a sliding spectrogram along a time wave.

Usage

dynspectro(wave, f, channel = 1, slidframe = 10,
wl = 512, wn = "hanning", zp = 0, ovlp = 75,
fftw = FALSE, dB = TRUE, plot = TRUE,
title = TRUE, osc = FALSE,
tlab = "Time (s)", flab = "Frequency (kHz)", alab = "Amplitude",
from = NULL, to = NULL,
collevels = NULL, palette = spectro.colors,
envt = NULL, msmooth = NULL, ksmooth = NULL,
coltitle = "black", colbg = "white", colline = "black",
colaxis = "black", collab = "black", cexlab = 1,
fontlab = 1, colwave = "black",
coly0 = "lightgrey", colcursor = "red", bty = "l")

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

slidframe

size of the sliding frame (in percent of the wave duration).

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

fftw

if TRUE calls the function FFT of the library fftw. See Notes of the spectro.

dB

a logical, if TRUE then uses dB values

plot

logical, if TRUE plots in an ew graphics device the successive spectrograms sliding along the time wave (by default TRUE).

title

logical, if TRUE adds a title with the time position of the current spectrogram along the time wave.

osc

logical, if TRUE plots an oscillogram beneath the sliding spectrogram with a cursor showing the position of the current spectrum (by default FALSE).

tlab

title of the time axis.

flab

title of the frequency axis.

alab

title of the amplitude axis.

from

start mark where to compute the sliding spectrogram (in s).

to

end mark where to compute the sliding spectrogram (in s).

collevels

a set of levels which are used to partition the amplitude range of the spectrogram.

palette

a color palette function to be used to assign colors in the plot.

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.

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

Value

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 wl/2.

Details

Use the slider panel to move along the time wave. The function requires the package rpanel that is based on the package tcltk. The function is mainly written for inspecting long sounds. The function is based on image for fast display when spectro is based on filled.contour. Displaying the amplitude envelope with the argument envt can slow down significantly the display.

See Also

spectro, spectro3D, wf, spec, dynspec, fft, oscillo, env.

Examples

Run this code
# NOT RUN {
data(sheep)
require(rpanel)
dynspectro(sheep, ovlp=95, osc=TRUE)
# }

Run the code above in your browser using DataLab