Skip to contents

Acoustic Complexity Index - Batch process

Usage

aci_folder(
  folder = NULL,
  list = NULL,
  start = 0,
  end = 1,
  unit = "minutes",
  save.csv = TRUE,
  csv.name = "aci_results.csv",
  freq.res = 50,
  win.fun = "hanning",
  min.freq = NA,
  max.freq = NA,
  j = NA,
  noise.red = 2,
  rm.offset = TRUE,
  n.cores = -1
)

Arguments

folder

a path to the folder with audio files to import.

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'.

save.csv

logical. Whether to save a csv in the working directory.

csv.name

character vector. When 'save.csv' is TRUE, optionally provide a file name.

freq.res

numeric. The frequency resolution to use (Hz per bin) which will determine the window length for the FFT (sampling rate / frequency resolution).

win.fun

window function (filter to handle spectral leakage); "bartlett", "blackman", "flattop", "hamming", "hanning", or "rectangle".

min.freq

minimum frequency to use when calculating the value, in Hertz. Default = 0.

max.freq

maximum frequency to use when calculating the value, in Hertz. Default = NA (Nyquist).

j

the cluster size, in seconds. Default = NA (Duration of the audio file).

noise.red

numeric; controls the application of noise reduction. If set to 1, noise reduction is applied to each row by subtracting the median from the amplitude values. If set to 2, noise reduction is applied to each column similarly. If set to 0, noise reduction is not applied.

rm.offset

logical; if set to TRUE, the function will remove DC offset before computing ADI. Default = TRUE.

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).

recursive

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

Value

A tibble (data frame) with the ACI values for each channel (if stereo), metadata, and the parameters used for the calculation.

Details

Optimized to facilitate working with a folder of audio files before importing them into R. Modifications by Francisco Rivas (frivasfu@purdue.edu // fcorivasf@gmail.com) April 2024

Examples

aci_folder(path/to/folder)
#> Working on it...
#> Error: object 'path' not found