spectral_blur_ratio {baRulho}R Documentation

Measure blur ratio in the frequency domain

Description

spectral_blur_ratio measures blur ratio of frequency spectra from signals referenced in an extended selection table.

Usage

spectral_blur_ratio(X, parallel = 1, pb = TRUE, method = 1, ssmooth = 50, 
output = "est", img = FALSE, res = 150, hop.size = 11.6, wl = NULL, 
ovlp = 70, pal = reverse.gray.colors.2, collevels = seq(-60, 0, 5), dest.path = NULL)

Arguments

X

object of class 'extended_selection_table' created by the function selection_table from the warbleR package.

parallel

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).

pb

Logical argument to control if progress bar is shown. Default is TRUE.

method

Numeric vector of length 1 to indicate the 'experimental design' for measuring spectrum correlation. Two methods are available:

  • 1: compare all signals with their counterpart that was recorded at the closest distance to source (e.g. compare a signal recorded at 5m, 10m and 15m with its counterpart recorded at 1m). This is the default method.

  • 2: compare all signals with their counterpart recorded at the distance immediately before (e.g. a signal recorded at 10m compared with the same signal recorded at 5m, then signal recorded at 15m compared with same signal recorded at 10m and so on).

ssmooth

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 100.

output

Character vector of length 1 to determine if an extended selection table ('est', default), a data frame ('data.frame') or a list ("list") containing the extended selection table (first object in the list) and all (smoothed) wave envelopes (second object in the list) is returned. The envelope data can be used for plotting.

img

Logical argument to control if image files in 'jpeg' format containing the images being compared and the corresponding spectra are produced. Default is no images ( FALSE).

res

Numeric argument of length 1. Controls image resolution. Default is 150 (faster) although 300 - 400 is recommended for publication/presentation quality.

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.

wl

A numeric vector of length 1 specifying the window length of the spectrogram, default is NULL. If supplied, 'hop.size' is ignored. Applied to both spectra and spectrograms on image files.

ovlp

Numeric vector of length 1 specifying the percent overlap between two consecutive windows, as in spectro. Default is 70. Applied to both spectra and spectrograms on image files.

pal

A color palette function to be used to assign colors in the plot, as in spectro. Default is reverse.gray.colors.2.

collevels

Numeric vector indicating a set of levels which are used to partition the amplitude range of the spectrogram (in dB) as in spectro. Default is seq(-60, 0, 5).

dest.path

Character string containing the directory path where the image files will be saved. If NULL (default) then the folder containing the sound files will be used instead.

Details

Spectral blur ratio measures the degradation of sound as a function of the change in signal energy in the frequency domain, analogous to the blur ratio proposed by Dabelsteen et al (1993) for the time domain (and implemented in blur_ratio). Low values indicate low degradation of signals. The function measures the blur ratio of spectra from signals in which a reference playback has been re-recorded at different distances. Spectral blur ratio is measured as the mismatch between power spectra (expressed as probability density functions) of the reference signal and the re-recorded signal. The function compares each signal type to the corresponding reference signal. The 'signal.type' column must be used to tell the function to only compare signals belonging to the same category (e.g. song-types). Two methods for setting the experimental design are provided. All wave objects in the extended selection table must have the same sampling rate so the length of spectra is comparable.

Value

Data frame similar to input data, but also includes a new column (spectral.blur.ratio) with the blur ratio values. If img = TRUE it also returns 1 image file (in 'jpeg' format) for each comparison showing spectrograms of both signals and the overlaid power spectrum (as probability mass functions (PMF)). Spectrograms are shown within the frequency range of the reference signal and also show vertical lines with the start and end of signals to allow users to visually check alignment. If output = 'list' the output would a list including the data frame just described and a data frame with spectra (amplitude values) for all signals.

Author(s)

Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)

References

Dabelsteen, T., Larsen, O. N., & Pedersen, S. B. (1993). Habitat-induced degradation of sound signals: Quantifying the effects of communication sounds and bird location on blur ratio, excess attenuation, and signal-to-noise ratio in blackbird song. The Journal of the Acoustical Society of America, 93(4), 2206.

Araya-Salas, M. (2020). baRulho: baRulho: quantifying habitat-induced degradation of (animal) acoustic signals in R. R package version 1.0.2

See Also

blur_ratio

Examples

{
# load example data
data("playback_est")

# remove ambient selections
playback_est <- playback_est[playback_est$signal.type != "ambient", ]

# using method 1
spectral_blur_ratio(X = playback_est)

# using method 2
spectral_blur_ratio(X = playback_est, method = 2)
}


[Package baRulho version 1.0.6 Index]