fspec: Generate spectrograms

Description Usage Arguments Value Examples

View source: R/spectro.R

Description

This function returns the spectrographic representation of a time wave in the absolute scale or in decibels (dB) using the Fast Fourier transform (FFT).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
fspec(
  wave,
  channel = "left",
  FFT_size = 256,
  FFT_overlap = 0.875,
  FFT_win = "hann",
  LPF,
  HPF = 0,
  tlim = NULL,
  flim = NULL,
  rotate = FALSE,
  to_dB = TRUE
)

Arguments

wave

a Wave object.

channel

character. Channel to keep for analysis in a stereo recording: "left" or "right". Default setting is left.

FFT_size

integer. Size of the Fast Fourrier Transform (FFT) window. Default setting is 256.

FFT_overlap

numeric. Percentage of overlap between two FFT windows (from 0 to 1). Default setting is 0.875.

FFT_win

character. Specify the type of FFT window: "hann", "blackman4", or "blackman7". Default setting is "hann".

LPF

integer. Low-Pass Filter (Hz). Frequencies above the cutoff are greatly attenuated. Default setting is the Nyquist frequency of the recording.

HPF

integer. High-Pass Filter (Hz). Frequencies below the cutoff are greatly attenuated. Default setting is 0 Hz.

tlim

numeric. Specify the time limits on the X-axis in seconds (s). Default setting is NULL, i.e no time limits.

flim

numeric. Specify the frequency limits on the Y-axis in Hz. Default setting is NULL, i.e. frequency limits are equal to c(0, LPF).

rotate

logical. Should the matrix be rotated 90° counter clockwise ? Default setting is FALSE.

to_dB

logical. Convert magnitude values to decibels (dB)? Default is TRUE.

Value

A matrix of amplitude or decibel (dB) values in the time / frequency domain.

Examples

1
2
data(myotis)
image(fspec(myotis, tlim = c(1, 2), rotate = TRUE))

bioacoustics documentation built on Feb. 8, 2022, 5:06 p.m.