Skip to contents

Computes summary statistics based on spectral similarity (consecutive pairwise comparison of PSD vectors) over user-defined time steps for specified frequency bands.

Usage

spectral_dynamics(
  wave,
  timestep = 5,
  rmoffset = TRUE,
  highpass = 0,
  lfc = c(0, 2),
  mfc = c(2, 10),
  hfc = c(10, 16),
  ufc = c(16, 24)
)

Arguments

wave

A Wave object representing the audio file to be analyzed.

timestep

Numeric value indicating the time step (in seconds) for segmenting the audio file to calculate the Power Spectral Densitiess.

rmoffset

Logical value indicating whether to remove DC offset from the audio (default is TRUE).

highpass

Numeric value indicating the cutoff frequency for the high-pass filter (in Hz, default is 0 Hz).

lfc

A numeric vector of length 2 indicating the lower frequency range (e.g., c(0, 2) for 0-2 Hz).

mfc

A numeric vector of length 2 indicating the mid-frequency range (e.g., c(2, 10) for 2-10 Hz).

hfc

A numeric vector of length 2 indicating the high-frequency range (e.g., c(10, 16) for 10-16 Hz).

ufc

A numeric vector of length 2 indicating the ultra-frequency range (e.g., c(16, 24) for 16-24 Hz).

Value

A tibble with summary statistics (standard deviation, variance, mean, range) derived from spectral similarity for each frequency band. The frequency bands are ordered from highest (ufc) to lowest (lfc).

Examples

# Assuming `wave` is a Wave object loaded in R
result <- spectral_dynamics(wave, timestep = 5, lfc = c(0, 2), mfc = c(2, 10), hfc = c(10, 16), ufc = c(16, 24))
#> Error: object 'wave' not found
print(result)
#> Error: object 'result' not found