Skip to contents

This function analyzes the spectral occupancy of 'low', 'mid', 'high', and 'ultra' frequency bands, which limits are defined by the user. It calculates the proportion of cells in each frequency band exceeding a specified dB cutoff and optionally plots the binary spectrogram with frequency bands delimited.

Usage

fci(
  wave,
  channel = "left",
  hpf = 0,
  cutoff = -60,
  freq.res = 50,
  spectrogram = FALSE,
  ggplot = FALSE,
  plot.title = "Frequency Cover Analysis",
  sound.color = "#045E10",
  lf.min = 0,
  lf.max = 1500,
  mf.min = 1500,
  mf.max = 8000,
  hf.min = 8000,
  hf.max = 18000,
  uf.min = 18000,
  uf.max = 24000,
  verbose = FALSE
)

Arguments

wave

A Wave object containing the audio data to be analyzed.

channel

Character. If the Wave is stereo, select a channel to analyze. Options are "left", "right", and "mix", which combines L and R channels into a single mono Wave. Default is "left".

cutoff

Numeric. The amplitude cutoff in dB above which the frequency bins are considered active. Default is 70 dB.

freq.res

Numeric. The frequency resolution to be used when selecting a window length for the FFT.

spectrogram

Logical. If TRUE, the function will generate and display a plot of the binary spectrogram with the frequency bands marked. Default is TRUE.

ggplot

Logical. If TRUE, the plot is output is a ggplot object. If FALSE (default), the base plot function is used (faster rendering).

plot.title

Character. An optional title for the plot.

lf.min

Numeric. The minimum frequency (in Hz) for the low-frequency band. Default is 1 Hz.

lf.max

Numeric. The maximum frequency (in Hz) for the low-frequency band. Default is 2000 Hz.

mf.min

Numeric. The minimum frequency (in Hz) for the mid-frequency band. Default is 2000 Hz.

mf.max

Numeric. The maximum frequency (in Hz) for the mid-frequency band. Default is 12000 Hz.

hf.min

Numeric. The minimum frequency (in Hz) for the high-frequency band. Default is 12000 Hz.

hf.max

Numeric. The maximum frequency (in Hz) for the high-frequency band. Default is 22000 Hz.

verbose

Logical. If TRUE, details of dynamic range will be printed on the console.

Value

A tibble and an optional spectrogram.

Examples

if (FALSE) { # \dontrun{
# Assuming 'wave' is a Wave object
results <- fci(wave, cutoff = 65, freq.res = 100,  spectrogram = TRUE)
print(results)
} # }