Skip to contents

Quantifies temporal variability in acoustic energy across frequency bins by comparing mean power spectra (MPS) between consecutive segments of an audio recording. Useful for identifying periods of rapid acoustic change in soundscapes.

Usage

dynamicity(wave, fun = "mean", segment_l = 5, freq_res = 50, plot = TRUE)

Arguments

wave

A Wave object (from tuneR package) containing the audio data.

fun

Function to apply in spectral calculation ("mean", "var", etc.). Passed to seewave::meanspec(FUN).

segment_l

Length (in seconds) of each analysis segment. Longer segments provide better frequency resolution but fewer temporal comparisons (default: 5s).

freq_res

Frequency resolution (in Hz) for spectral analysis. Higher values increase frequency binning (default: 50Hz).

plot

Logical. If TRUE (default), generates a heatmap of spectral changes.

Value

A list with components:

  • dynamicity: Scalar metric of overall acoustic variability (mean ΔMPS across all bins).

  • delta_mps: Matrix of absolute MPS differences between segments (frequency bins × time).

  • dynamicity_vector: Frequency-specific variability (sum of ΔMPS per bin).

  • frequency: Vector of frequency bins (kHz).

  • time: Vector of segment mid-point times (s).

Details

The function works by:

  1. Dividing the audio into equal-length segments.

  2. Calculating mean power spectra (MPS) for each segment.

  3. Computing absolute differences in MPS between consecutive segments.

  4. Summarizing these differences as a "dynamicity" metric.

Examples

if (FALSE) { # \dontrun{
library(tuneR)
data(tico)
dyn <- dynamicity(tico, segment_l = 1, freq_res = 100)
} # }