baRulho: quantifying degradation of (animal) sounds

Status at rOpenSci Software Peer Reviewlifecycle Dependencies Project Status: Active The project has reached a stable, usable state and is being actively developed. License: GPL v3 minimal R version CRAN_Status_Badge Total Downloads Codecov test coverage R-CMD-check

baRulho logo

baRulho is intended to facilitate the implementation of (animal) sound propagation experiments, which typically aim to quantify changes in signal structure when transmitted in a given habitat by broadcasting and re-recording animal sounds at increasing distances.

These experiments aim to answer research questions such as:

A common sequence of steps to experimentally test hypotheses related to sound propagation is depicted in the following diagram:

Diagram depicting a typical workflow for a experiment working on signal propagation and degradation. Nodes with black font indicate steps that can be conducted using baRulho functions. Blue nodes denote the functions that can be used at those steps.

 

baRulho offers functions for the critical steps in this workflow (those in black, including “checks”) that require acoustic data manipulation and analysis.

The main features of the package are:

baRulho builds upon functions and data formats from the warbleR and seewave packages, so some experience with these packages is advised.

This package has been peer-reviewed by rOpenSci.

Installing baRulho

Install/load the package from CRAN as follows:

# From CRAN would be
# install.packages("baRulho")

# load package
library(baRulho)

It can also be installed from R-Universe in this way:

install.packages("baRulho", repos = "https://ropensci.r-universe.dev")

To install the latest developmental version from github you will need the R package remotes:

# install remotes if not installed
if (!requireNamespace("remotes")) {
  install.packages("remotes")
}

# From github
remotes::install_github("ropensci/baRulho")

# load package
library(baRulho)

Further system requirements due to the dependency seewave may be needed.

Quick example

The package comes with example data from a sound propagation experiment, so you can measure degradation right away. The code below takes re-recordings of the same synthetic sounds made at increasing distances, sets the closest-distance recording as the reference for each sound, and measures blur ratio – the mismatch between the amplitude envelope of a re-recorded sound and that of its reference:

library(baRulho)

# load example data: re-recordings of synthetic sounds at increasing distances
data("test_sounds_est")

# set the closest-distance recording as reference for each sound
test_sounds_est <- set_reference_sounds(X = test_sounds_est)

# measure blur ratio (time-domain degradation) for every re-recorded sound
blur_ratio(X = test_sounds_est)
##     sound.files sound.id distance blur.ratio
##  10m_closed.wav    freq1       10 0.05665972
##  30m_closed.wav    freq1       30 0.08490683
##    10m_open.wav    freq1       10 0.12073137
##    30m_open.wav    freq1       30 0.12541305
##  10m_closed.wav    freq4       10 0.09586486
##  30m_closed.wav    freq4       30 0.08470761
##    10m_open.wav    freq4       10 0.19304500
##    30m_open.wav    freq4       30 0.13455331

Blur ratio increases with distance, as expected: sounds become more degraded the farther they travel. This is one of several degradation metrics in baRulho – see spectrum_blur_ratio(), excess_attenuation(), signal_to_noise_ratio(), envelope_correlation(), tail_to_signal_ratio(), and spcc() for others, each capturing a different aspect of how a sound changes as it propagates through a habitat. plot_degradation() and plot_blur_ratio() let you inspect these changes visually.

Vignettes

Take a look at the vignettes for a more detailed overview of the main features of the package, including how to align re-recorded test sounds before measuring degradation:

Other packages

The packages seewave and tuneR provide a huge variety of functions for acoustic analysis and manipulation. They mostly work on wave objects already imported into the R environment. The package warbleR provides functions to visualize and measure sounds already referenced in annotation tables, similar to baRulho. The package Rraven facilitates the exchange of data between R and Raven sound analysis software (Cornell Lab of Ornithology) and can be very helpful for incorporating Raven as the annotating tool into acoustic analysis workflow in R. The package ohun works on automated detection of sound events, providing functions to diagnose and optimize detection routines.

Citation

Please cite baRulho as follows:

Araya-Salas, M., Grabarczyk, E. E., Quiroz-Oliva, M., García-Rodríguez, A., & Rico-Guevara, A. (2025). Quantifying degradation in animal acoustic signals with the R package baRulho. Methods in Ecology and Evolution, 00, 1–12. https://doi.org/10.1111/2041-210X.14481

References

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

  2. Marten, K., & Marler, P. (1977). Sound transmission and its significance for animal vocalization. Behavioral Ecology and Sociobiology, 2(3), 271-290.

  3. Morton, E. S. (1975). Ecological sources of selection on avian sounds. The American Naturalist, 109(965), 17-34.