Acoustic Diversity Index from Villanueva-Rivera et al. 2011. The ADI is calculated by dividing the spectrogram into frequency bands (default 10), taking the proportion of energy in each band above an energy threshold (default -50 dBFS), and then calculating the Shannon's Diversity from those proportions. The new version allows the user to choose between different ways to compute the proportions before calculating the Shannon, among other new parameter options (see Details).
Usage
adi(
wave,
freq.res = 50,
win.fun = "hanning",
min.freq = 0,
max.freq = 10000,
n.bands = 10,
cutoff = -60,
norm.spec = FALSE,
noise.red = 0,
rm.offset = TRUE,
props = TRUE,
prop.den = 2,
db.fs = TRUE,
use.vegan = FALSE
)
Arguments
- wave
an object of class Wave imported with the readWave function of the tuneR package.
- freq.res
Numeric. Frequency resolution in Hz. This value determines the "height" of each frequency bin and, therefore, the window length to be used (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 compute the spectrogram.
- max.freq
maximum frequency to compute the spectrogram.
- n.bands
number of bands to split the spectrogram.
- cutoff
dB threshold to calculate energy proportions.
- 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, noise reduction is not applied.
- rm.offset
logical; if set to TRUE, the function will remove DC offset before computing ADI. Default = TRUE.
- props
logical; if set to TRUE, the function stores the energy proportion values for each frequency band and channel. Default = TRUE.
- prop.den
numeric; indicates how the energy proportion is calculated.
- db.fs
logical; if TRUE, the amplitude scale is expressed as decibels Full Scale (dBFS). Only used when norm = FALSE.
- use.vegan
logical; if TRUE, the diversity() function from the vegan package is called to compute Shannon's entropy. This is only intended for when the user wants to obtain a result equivalent to the original soundecology package. Default = FALSE.
Value
A tibble (data frame) with the ADI values for each channel (if stereo), metadata, and the parameters used for the calculation.
Details
Options for the 'prop.den' parameter: 1 = The original calculation from the "soundecology" package is applied. The denominator of the proportion equals to all the cells in the same frequency band. 2 = A "true Shannon" proportion is calculated, where the "whole community" equals to the cells above the decibel threshold across the spectrogram (up to 'max_freq'). Another important update is that now the spectrogram is not normalized by default, which made recordings#' with different signal-to-noise ratio not comparable.
Examples
data(tropicalsound)
#> Warning: data set 'tropicalsound' not found
adi(tropicalsound)
#> Error: object 'tropicalsound' not found