Skip to contents

Fast Spectrogram with Derived Pseudo-Oscillogram and Power Spectrum

Usage

audioplot(
  wave,
  fft = "auto",
  enhance = "time",
  overlap = 75,
  window = "hann",
  contrast = 60,
  flim = NULL,
  tlim = NULL,
  zero.pad = 8,
  output.file = NULL,
  plot.title = "",
  use.ragg = TRUE,
  palette = "inferno",
  osc.show = TRUE,
  osc.color = "black",
  osc.height = 0.25,
  spec.show = TRUE,
  spec.fun = "mean",
  spec.color = "black",
  spec.width = 0.15,
  spec.linear = TRUE
)

Arguments

wave

Wave object from tuneR package

fft

Size of FFT window (must be power of 2). Default is "auto", which automatically calculates a proper length (see q.factor options).

enhance

Either 'freq' to prioritize frequency resolution or 'time' to prioritize temporal resolution.

overlap

Overlap between windows (0 to 95%)

window

Type of window function ("hann", "hamming", "blackman")

contrast

Controls the dynamic range for visualization (0-100%)

flim

Numeric list of length 2. Frequency limits, in kHz.

zero.pad

Zero-padding factor

output.file

Optional file path to save the spectrogram

plot.title

Plot title

use.ragg

Whether to use RAGG for GPU-accelerated rendering

palette

Color palette for spectrogram

osc.show

Whether to show the oscillogram

osc.color

Color for the pseudo-oscillogram

osc.height

Relative height of oscillogram (0-1)

spec.show

Whether to show the power spectrum

spec.color

Color for the power spectrum.

spec.width

Relative width of power spectrum (0-1)

spec.linear

Whether to show the power spectrum in linear scale. Default is TRUE.

Value

Invisible list containing spectrogram data

Details

When fft is set to 'auto' (recommended), the function takes the 'enhance' argument to decide whether to enhance spectral or temporal resolution. We recommend "enhance= 'freq'" for high-quality factor (i.e., 'tonal') sounds such as those produced by most crickets, and "enhance='time" for low-quality factor (i.e., 'raspy') sounds such as those produced by katydids and cicadas.

Examples

if (FALSE) { # \dontrun{
library(RthopteraSounds)
data("coryphoda")
data("gryllus")
audioplot(coryphoda, enhance = "time",
osc.show = F, palette = 'Zissou 1')
audioplot(coryphoda, enhance = 'time', osc.show = F,
spec.linear = T) # great
audioplot(coryphoda, enhance = "time")
audioplot(gryllus, enhance = "freq")
audioplot(gryllus, enhance = "time")} # }