View source: R/signal_to_noise_ratio.R
signal_to_noise_ratio | R Documentation |
signal_to_noise_ratio
measures attenuation as signal-to-noise ratio of sounds referenced in an extended selection table.
signal_to_noise_ratio(
X,
mar = NULL,
cores = getOption("mc.cores", 1),
pb = getOption("pb", TRUE),
eq.dur = FALSE,
noise.ref = c("adjacent", "custom"),
snr.formula = 1,
bp = "freq.range",
hop.size = getOption("hop.size", 1),
wl = getOption("wl", NULL),
ovlp = getOption("ovlp", 0),
path = getOption("sound.files.path", ".")
)
X |
Object of class 'data.frame', 'selection_table' or 'extended_selection_table' (the last 2 classes are created by the function |
mar |
numeric vector of length 1. Specifies the margins adjacent to the start point of the annotation over which to measure ambient noise. |
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 |
eq.dur |
Logical. Controls whether the ambient noise segment that is measured has the same duration
to that of the sound (if |
noise.ref |
Character vector of length 1 to determined which noise segment must be used for measuring ambient noise. Two options are available:
|
snr.formula |
Integer vector of length 1. Selects the formula to be used to calculate the signal-to-noise ratio (S = signal , N = background noise):
|
bp |
Numeric vector of length 2 giving the lower and upper limits of a frequency bandpass filter (in kHz). Alternatively, when set to 'freq.range' (default), the function will use the 'bottom.freq' and 'top.freq' for each sound as the bandpass range. |
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 |
ovlp |
Numeric vector of length 1 specifying the percentage of overlap between two
consecutive windows, as in |
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 |
Signal-to-noise ratio (SNR) measures sound amplitude level in relation to ambient noise. Noise is measured on the background noise immediately before the test sound. A general margin in which ambient noise will be measured must be specified. Alternatively, a selection of ambient noise can be used as reference (see 'noise.ref' argument). When margins overlap with another sound nearby, SNR will be inaccurate, so margin length should be carefully considered. Any SNR less than or equal to one suggests background noise is equal to or overpowering the sound. The function will measure signal-to-noise ratio within the supplied frequency range (e.g. bandpass) of the reference signal ('bottom.freq' and 'top.freq' columns in 'X') by default (that is, when bp = 'freq.range'
. SNR can be ~0 when both tail and signal have very low amplitude.
Object 'X' with an additional column, 'signal.to.noise.ratio', with the signal-to-noise ratio values (in dB).
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.
Holland J, Dabelsteen T, Pedersen SB, Paris AL (2001) Potential ranging cues contained within the energetic pauses of transmitted wren song. Bioacoustics 12(1):3-20.
Darden, SK, Pedersen SB, Larsen ON, & Dabelsteen T. (2008). Sound transmission at ground level in a short-grass prairie habitat and its implications for long-range communication in the swift fox *Vulpes velox*. The Journal of the Acoustical Society of America, 124(2), 758-766.
excess_attenuation
Other quantify degradation:
blur_ratio()
,
detection_distance()
,
envelope_correlation()
,
plot_blur_ratio()
,
plot_degradation()
,
set_reference_sounds()
,
spcc()
,
spectrum_blur_ratio()
,
spectrum_correlation()
,
tail_to_signal_ratio()
{
# load example data
data("test_sounds_est")
# using measure ambient noise reference selections
signal_to_noise_ratio(X = test_sounds_est, mar = 0.05, noise.ref = "custom")
# using margin for ambient noise of 0.05 and adjacent measure ambient noise reference
signal_to_noise_ratio(X = test_sounds_est, mar = 0.05, noise.ref = "adjacent")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.