View source: R/spectrum_correlation.R
spectrum_correlation | R Documentation |
spectrum_correlation
measures frequency spectrum correlation of sounds referenced in an extended selection table.
spectrum_correlation(
X,
cores = getOption("mc.cores", 1),
pb = getOption("pb", TRUE),
cor.method = c("pearson", "spearman", "kendall"),
spec.smooth = getOption("spec.smooth", 5),
hop.size = getOption("hop.size", 11.6),
wl = getOption("wl", NULL),
ovlp = getOption("ovlp", 70),
path = getOption("sound.files.path", "."),
n.bins = 100
)
X |
The output of |
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 |
cor.method |
Character string indicating the correlation coefficient to be applied ("pearson", "spearman", or "kendall", see |
spec.smooth |
Numeric vector of length 1 determining the length of the sliding window used for a sum smooth for power spectrum calculation (in kHz). Default is 5. |
hop.size |
A numeric vector of length 1 specifying the time window duration (in ms). Default is 11.6 ms, which is equivalent to 512 wl for a 44.1 kHz sampling rate. Ignored if 'wl' is supplied. Can be set globally for the current R session via the "hop.size" option (see |
wl |
a vector with a single even integer number specifying the window length of the spectrogram, default is |
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 |
n.bins |
Numeric vector of length 1 specifying the number of frequency bins to use for representing power spectra. Default is 100. If null the raw power spectrum is used (note that this can result in high RAM memory usage for large data sets). Power spectrum values are interpolated using |
spectral correlation measures the similarity of two sounds in the frequency domain. The function measures the spectral correlation coefficients of sounds in which a reference playback has been re-recorded at increasing distances. Values range from 1 (identical frequency spectrum, i.e. no degradation) to 0. The 'sound.id' column must be used to indicate the function to only compare sounds belonging to the same category (e.g. song-types). The function will then compare each sound to the corresponding reference sound. Two methods for computing spectral correlation are provided (see 'method' argument). The function uses meanspec
internally to compute power spectra. Use spectrum_blur_ratio
to extract raw spectra values. NA is returned if at least one the power spectra cannot be computed.
Object 'X' with an additional column, 'spectrum.correlation', containing the computed frequency spectrum correlation coefficients.
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.
Apol, C.A., Sturdy, C.B. & Proppe, D.S. (2017). Seasonal variability in habitat structure may have shaped acoustic signals and repertoires in the black-capped and boreal chickadees. Evol Ecol. 32:57-74.
envelope_correlation
, spectrum_blur_ratio
Other quantify degradation:
blur_ratio()
,
detection_distance()
,
envelope_correlation()
,
plot_blur_ratio()
,
plot_degradation()
,
set_reference_sounds()
,
signal_to_noise_ratio()
,
spcc()
,
spectrum_blur_ratio()
,
tail_to_signal_ratio()
{
# load example data
data("test_sounds_est")
# method 1
# add reference column
Y <- set_reference_sounds(X = test_sounds_est)
# run spectrum correlation
spectrum_correlation(X = Y)
# method 2
Y <- set_reference_sounds(X = test_sounds_est, method = 2)
# spectrum_correlation(X = Y)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.