View source: R/noise_profile.R
noise_profile | R Documentation |
noise_profile
Measure full spectrum sound pressure levels (i.e. noise profiles) in sound files or extended selection tables.
noise_profile(
X = NULL,
files = NULL,
mar = NULL,
noise.ref = c("adjacent", "custom"),
cores = getOption("mc.cores", 1),
pb = getOption("pb", TRUE),
path = getOption("sound.files.path", "."),
bp = NULL,
hop.size = getOption("hop.size", 1),
wl = getOption("wl", NULL),
PSD = FALSE,
norm = TRUE,
dB = c("A", "B", "C", "D", "ITU", "max0"),
averaged = TRUE
)
X |
Object of class 'data.frame', 'selection_table' or 'extended_selection_table' (the last 2 classes are created by the function |
files |
Character vector with names of wave files to be analyzed. Files must be found in 'path' supplied (or in the working directory if 'path' is not supplied). Default is |
mar |
numeric vector of length 1. Specifies the margins adjacent to
the start and end points of selection over which to measure ambient noise. Required if 'X' is supplied and ignored if not supplied. Default is |
noise.ref |
Character vector of length 1 to determined which noise segment must be used for measuring ambient noise. Ignored if 'X' is not supplied. Two options are available:
|
cores |
Numeric vector of length 1. Controls whether parallel computing is applied by specifying the number of cores to be used. Default is 1 (i.e. no parallel computing). Can be set globally for the current R session via the "mc.cores" option (see |
pb |
Logical argument to control if progress bar is shown. Default is |
path |
Character string containing the directory path where the sound files are found. Only needed when 'X' is not an extended selection table. If not supplied the current working directory is used. Can be set globally for the current R session via the "sound.files.path" option (see |
bp |
Numeric vector of length 2 giving the lower and upper limits of a frequency bandpass filter (in kHz). Default is |
hop.size |
A numeric vector of length 1 specifying the time window duration (in ms). Default is 1 ms, which is equivalent to ~45 wl for a 44.1 kHz sampling rate. Ignored if 'wl' is supplied. |
wl |
A numeric vector of length 1 specifying the window length of the spectrogram, default
is NULL. Ignored if |
PSD |
Logical to control whether the Probability Mass Function (the probability distribution of frequencies). See |
norm |
Logical to control whether amplitude values are normalized (divided by the maximum) so the highest value is 1. See |
dB |
A character string of length 1 specifying the type dB to return: "max0" for a maximum dB value at 0, "A", "B", "C", "D", and "ITU" for common dB weights. See |
averaged |
Logical to control if frequency spectra are averaged within a sound file. Default is |
The function estimates full spectrum sound pressure levels (i.e. noise profiles) of ambient noise. This can be done on data frames/(extended) selection tables (using the segments containing no target sound or the 'ambient' sound id) or over complete sound files in the working directory (or path supplied). The function uses meanspec
internally to calculate frequency spectra.
A data frame containing the frequency spectra for each sound file or wave object (if 'X' is supplied and is of class 'extended.selection.table').
Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)
Araya-Salas M., E. Grabarczyk, M. Quiroz-Oliva, A. Garcia-Rodriguez, A. Rico-Guevara. (2023), baRulho: an R package to quantify degradation in animal acoustic signals .bioRxiv 2023.11.22.568305..
excess_attenuation
Other miscellaneous:
add_noise()
,
attenuation()
{
# load example data
data("test_sounds_est")
# measure on custom noise reference
noise_profile(X = test_sounds_est, mar = 0.01, pb = FALSE, noise.ref = "custom")
# remove noise selections so noise is measured right before the signals
pe <- test_sounds_est[test_sounds_est$sound.id != "ambient", ]
noise_profile(X = pe, mar = 0.01, pb = FALSE, noise.ref = "adjacent")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.