Learn R Programming

seewave (version 2.1.8)

wf: Waterfall display

Description

This function returns a waterfall display of a short-term Fourier transform or of any matrix.

Usage

wf(wave, f, channel = 1, wl = 512, zp = 0, ovlp = 0, fftw= FALSE, dB = "max0",
dBref = NULL, wn = "hanning", x = NULL,
hoff = 1, voff = 1, col = heat.colors,
xlab = "Frequency (kHz)", ylab = "Amplitude (dB)",
xaxis = TRUE, yaxis = TRUE,
density = NULL, border = NULL, lines = FALSE, lwd=NULL, ...)

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

wl

window length for the analysis (even number of points). (by default = 512)

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 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 dB is TRUE. NULL by default but should be set to 2*10e-5 for a 20 microPa reference.

wn

window name, see ftwindow (by default "hanning").

x

a matrix if wave is not provided.

hoff

horizontal 'offset' which shifts actual x-values slightly per row for visibility. Fractional parts will be removed.

voff

vertical 'offset' which separates traces.

col

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

xlab

title of the frequency x-axis.

ylab

title of the amplitude y-axis.

xaxis

a logical, if TRUE adds the frequency x-axis according to f.

yaxis

a logical, if TRUE adds the amplitude y-axis according.

density

argument of polygon: the density of shading lines, in lines per inch. The default value of 'NULL' means that no shading lines are drawn. A zero value of 'density' means no shading nor filling whereas negative values (and 'NA') suppress shading (and so allow color filling).

border

argument of polygon: the color to draw the border. The default, 'NULL', means to use 'par("fg")'. Use 'border = NA' to omit borders.

lines

a logical, if TRUE plots lines instead of surfaces (polygons).

lwd

line width.

other graphical arguments to passed to plot

Details

Data input can be either a time wave (wave) or a matrix (x). In that case, if xaxis is set to TRUE the x-axis will follow the row index. To change it, turn xaxis to FALSE and use axis afterwards. See examples.

See Also

spectro, spectro3D, dynspec

Examples

Run this code
# NOT RUN {
data(tico)
wf(tico,f=22050)
# changing the display parameters
jet.colors <- colorRampPalette(c("blue", "green"))
wf(tico,f=22050, hoff=0, voff=2, col=jet.colors, border = NA)
# matrix input instead of a time wave and transparent lines display
m <- numeric()
for(i in seq(-pi,pi,len=40)) {m <- cbind(m,10*(sin(seq(0,2*pi,len=100)+i)))}
wf(x=m, lines=TRUE, col="#0000FF50",xlab="Time", ylab="Amplitude",
main="waterfall display")
# }

Run the code above in your browser using DataLab