Skip to contents

ds_spectrogram() adds a spectrogram to a dynaspec() object and sets how it is computed and drawn. Adding it again changes its settings.

Usage

ds_spectrogram(wl, ovlp, wn, pal, collevels, colbg, amp.trans, ...)

Arguments

wl

Window length (in samples), as in seewave::spectro().

ovlp

Percent overlap between consecutive windows, as in seewave::spectro().

wn

Window function name, as in seewave::spectro() (e.g. "hanning" or "blackman").

pal

Color palette function (e.g. viridis::viridis() or seewave::reverse.gray.colors.1()). Paged spectrograms also take the names of 'viridis' palettes (e.g. "magma") and 2 colors for a gradient (e.g. c("white", "black")).

collevels

Numeric vector with the amplitude levels (in dB) of the colors, as in seewave::spectro() (e.g. seq(-40, 0, 1)).

colbg

Background color of the spectrogram, shown where the amplitude is below the lowest level of 'collevels'. Default is the color of the lowest amplitude of the palette (e.g. white for seewave::reverse.gray.colors.1(), the default palette, or dark blue for viridis::mako()), so quiet parts and the background look the same.

amp.trans

Amplitude transformation to brighten paged spectrograms (values > 1 brighten quiet sounds; only used by ds_paged()).

...

Additional arguments passed to seewave::spectro().

Value

A layer to be added to a dynaspec() object with +.

Details

Only the arguments supplied are used; other settings take the defaults of each style (see ds_scrolling(), ds_paged() and ds_static()).

See also

Examples

data(scythebill)

x <- dynaspec(scythebill, flim = c(1.5, 5.5)) +
  ds_spectrogram(wl = 200, pal = viridis::mako, collevels = seq(-60, 0, 1))