Skip to contents

This function performs a frequency cover indices (FCI) on all WAV files within a specified folder. It processes each sound file in parallel (if specified) and saves the results in a CSV file.

Usage

fci_folder(
  folder = NULL,
  recursive = FALSE,
  list = NULL,
  start = 0,
  end = 1,
  unit = "minutes",
  output.csv = "fci_results.csv",
  channel = "each",
  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,
  n.cores = -1
)

Arguments

folder

The folder containing the WAV files to analyze.

recursive

Logical. Whether to search in subfolders. Default is FALSE.

list

An optional list (subset) of files in the folder to analyze. If provided, files outside the list will be excluded.

start

numerical. Where to start reading the Wave.

end

numerical. Where to end reading the Wave.

unit

character. Unit of measurement for 'start' and 'end'. Options are 'samples', 'seconds', 'minutes', 'hours'. Default is 'minutes'.

output.csv

The name of the CSV file where results will be saved. Default is "frequency_cover_results.csv".

channel

The channel to analyze: 'left', 'right', 'mix' (combine both), or 'each' (process left and right channels separately). Default is 'each'.

hpf

High-pass filter cutoff frequency in Hz. If 0, no high-pass filter is applied. Default is 0.

cutoff

The amplitude threshold (in dB) below which frequencies will be considered inactive. Default is -60.

freq.res

Frequency resolution of the spectrogram in Hz. Default is 100.

ggplot

Logical. Whether to use ggplot2 for plotting (if plot is TRUE). Default is FALSE.

plot.title

Title for the plot if plotting is enabled. Default is "Frequency Cover Analysis".

sound.color

The color to use for active frequencies in the plot. Default is "#045E10" (a dark green shade).

lf.min

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

lf.max

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

mf.min

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

mf.max

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

hf.min

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

hf.max

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

uf.min

The minimum frequency (in Hz) for the ultra-high-frequency band. Default is 18000.

uf.max

The maximum frequency (in Hz) for the ultra-high-frequency band. Default is 24000.

n.cores

The number of cores to use for parallel processing. Use n.cores = -1 to use all but one core. Default is NULL (single-core processing).

plot

Logical. Whether to generate plots for each file. Default is FALSE.

Value

A tibble containing the frequency cover analysis results for each file.

Examples

if (FALSE) { # \dontrun{
# Run frequency cover analysis on all WAV files in the folder "sound_files"
fci_folder("sound_files", output.csv = "results.csv", channel = "left", n.cores = 4)
} # }