Inspired by the "Bioacoustic Index" from the paper:Boelman NT, Asner GP, Hart PJ, Martin RE. 2007. Multi-trophic invasion resistance in Hawaii: bioacoustics, field surveys, and airborne remote sensing. Ecol Applications 17(8):2137-44. Based on Matlab code provided by NT Boelman. Boelman et al. 2007 used min.freq=2000, max.freq=8000, w.len=512. Several parts where changed, in particular log math, so this won't be directly comparable to the original code in the paper.
Usage
bi_folder(
folder = NULL,
recursive = FALSE,
start = 0,
end = 1,
unit = "minutes",
list = NULL,
save.csv = TRUE,
csv.name = "bi_results.csv",
w.len = 512,
w.fun = "hanning",
min.freq = 2000,
max.freq = 8000,
norm.spec = FALSE,
noise.red = 0,
rm.offset = TRUE,
n.cores = -1
)
Arguments
- folder
a path to the folder with audio files to import.
- recursive
Logical. Whether to search in subfolders. Default is TRUE.
- 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'.
- list
An optional list (subset) of files in the folder to analyze. If provided, files outside the list will be excluded.
- 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.
- w.len
the window length to compute the spectrogram (i.e., FFT window size).
- w.fun
window function (filter to handle spectral leakage); "bartlett", "blackman", "flattop", "hamming", "hanning", or "rectangle".
- min.freq
miminum frequency to use when calculating the value, in Hertz. Default = NA.
- max.freq
maximum frequency to use when calculating the value, in Hertz. Default = NA (Nyquist).
- norm.spec
logical; if TRUE, the spectrogram is normalized, scaled by its maximum value (not recommended because normalized spectrograms with different SNR are not comparable).
- 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 (Default), 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).
Value
A tibble (data frame) with the BI values for each channel (if stereo), metadata, and the parameters used for the calculation.