Learn R Programming

seewave (version 1.5.5)

spectro3D: 3D-spectrogram of a time wave

Description

This function returns a three-dimension spectrographic representation of a time wave. The function corresponds to short-term Fourier transform.

Usage

spectro3D(wave, f, wl = 512, wn = "hanning", zp = 0,
ovlp = 0, dB = "max0", dBref = NULL, plot = TRUE,
magt = 10, magf = 10, maga = 2,
palette = rev.terrain.colors)

Arguments

wave
a vector, a matrix (first column), an object of class ts, Sample (left channel), or Wave (left channel).
f
sampling frequency of wave (in Hz). Does not need to be specified if wave is an object of class ts, Sample, or Wave<
wl
length of the window for the analysis (even number of points).
wn
window name, see ftwindow (by default "hanning").
zp
zero-padding (even number of points), see Details.
ovlp
overlap between two successive windows (in % ).
dB
a character string specifying the type dB to return: "max0" for a maximum dB value at 0, "A", "B", "C" and "D" 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.
plot
logical, if TRUE plots the spectrogram (by default TRUE).
magt
magnification of the time axis.
magf
magnification of the frequency axis.
maga
magnification of the amplitude axis.
palette
a color palette function to be used to assign colors in the plot, see Details.

Value

  • If plot is FALSE, this function returns a matrix. Each column corresponds to a Fourier transform of length wl/2.

Details

Following Heisenberg uncertainty principle, the short-term Fourier transform cannot be precised in both time and frequency. The temporal and frequency precisions of the function are actually dependent of the wl value. Choosing a high wl value will increase the frequency resolution but reduce the temporal one, and vice versa. The frequency precision is obtained by calculating the ratio f/wl, and the temporal precision is obtained by calculating the reverse ratio wl/f. This problem can be reduced in some way with zp that adds 0 values on both sides of the analysis window. This increases frequency resolution without altering time resolution. Any colour palette can be used. In particular, it is possible to use other palettes coming with seewave: rev.gray.colors.1, rev.gray.colors.2, spectro.colors, temp.colors, rev.heat.colors, rev.cm.colors, rev.topo.colors, corresponding to the reverse of heat.colors,topo.colors, cm.colors. Use magt, magf and maga to resize the plot.

See Also

spectro, dynspec, wf, fft.

Examples

Run this code
data(tico)
spectro3D(tico,f=22050,wl=512,ovlp=75,zp=16,maga=4,palette=rev.terrain.colors)

Run the code above in your browser using DataLab