The warbleR package is intended to facilitate the analysis of the structure of the animal acoustic signals in R. Users can enter their own data into a workflow that facilitates spectrographic visualization and measurement of acoustic parameters warbleR makes use of the fundamental sound analysis tools of the seewave package, and offers new tools for acoustic structure analysis. These tools are available for batch analysis of acoustic signals.
The main features of the package are:
The package offers functions for:
Most of the functions allow the parallelization of tasks, which distributes the tasks among several cores to improve computational efficiency. Tools to evaluate the performance of the analysis at each step are also available. All these tools are provided in a standardized workflow for the analysis of the signal structure, making them accessible to a wide range of users, including those without much knowledge of R. warbleR is a young package (officially published in 2017) currently in a maturation stage.
Most warbleR functions take as input annotation tables. An annotation table (or selection table in Raven’s and warbleR’s terminology) is a data set that contains information about the location in time (and sometimes in frequency) of the sounds of interest in one or more sound files. warbleR can take sound file annotations represented in the following R objects:
The data “lbh_selec_table” that comes with the package provides a good example will on the annotation data format used in warbleR:
data("lbh_selec_table")
lbh_selec_table
sound.files | channel | selec | start | end | bottom.freq | top.freq |
---|---|---|---|---|---|---|
Phae.long1.wav | 1 | 1 | 1.169 | 1.342 | 2.22 | 8.60 |
Phae.long1.wav | 1 | 2 | 2.158 | 2.321 | 2.17 | 8.81 |
Phae.long1.wav | 1 | 3 | 0.343 | 0.518 | 2.22 | 8.76 |
Phae.long2.wav | 1 | 1 | 0.160 | 0.292 | 2.32 | 8.82 |
Phae.long2.wav | 1 | 2 | 1.457 | 1.583 | 2.28 | 8.89 |
Phae.long3.wav | 1 | 1 | 0.627 | 0.758 | 3.01 | 8.82 |
Phae.long3.wav | 1 | 2 | 1.974 | 2.104 | 2.78 | 8.89 |
Phae.long3.wav | 1 | 3 | 0.123 | 0.255 | 2.32 | 9.31 |
Phae.long4.wav | 1 | 1 | 1.517 | 1.662 | 2.51 | 9.22 |
Phae.long4.wav | 1 | 2 | 2.933 | 3.077 | 2.58 | 10.23 |
Phae.long4.wav | 1 | 3 | 0.145 | 0.290 | 2.58 | 9.74 |
Take a look at the vignette ‘Annotation data format’ for more details on annotation data formats.
Bioacoustic analyzes generally follow a specific processing sequence and analysis. This sequence can be represented schematically like this:
We can group warbleR functions according to the bioacoustic analysis stages.
The query_xc()
function allows you to search and
download sounds from the free access database Xeno-Canto. You can also convert
.mp3 files to .wav, change the sampling rate of the files and correct
corrupt files, among other functions.
Function | Description | Works on | Output |
---|---|---|---|
check_sound_files | verify if sound files can be read | multiple wave files | data frame |
consolidate | consolidate sound files in a single folder | multiple wave files | data frame and wave files |
fix_wavs | fix waves that cannot be read in R | multiple wave files | wave files |
mp32wav | convert multiple mp3 files to wav format | multiple mp3 files | wave files |
query_xc | Search and download mp3 files from Xeno-Canto | Scientific names/data frame | mp3 files |
resample_est | resample wave objects in ext. selection tables | extended selection tables | extended selection tables |
remove_channels | remove channels in multiple wave files | multiple wave files | wave files |
remove_silence | remove silences in multiple wave files | multiple wave files | wave files |
duration_sound_files | measures duration in multiple wave files | multiple wave files | data frame |
info_sound_files | extract recording parameters from multiple wave files | multiple wave files | data frame |
It is recommended to make annotations in other programs and then import them into R (for example in Raven and import them with the Rraven package). However, warbleR offers some functions to facilitate manual or automatic annotation of sound files, as well as the subsequent manipulation:
Function | Description | Works on | Output |
---|---|---|---|
freq_range | detect frequency range in selection tables | multiple wave files | data frame |
tailor_sels | interactive tailoring of selections | selection tables | selection tables |
The annotations (or selection tables) can be manipulated and refined with a variety of functions. Selection tables can also be converted into the compact format extended selection tables:
Function | Description | Works on | Output |
---|---|---|---|
tailor_sels | interactive tailoring of selections | selection tables | selection tables |
sort_colms | order columns in an intuitive way | selection tables | selection tables |
cut_sels | save selections as individual wave files | selection tables | wave files |
filter_sels | subset selection tables based on filtered image files | selection tables, ext. selection tables, images | selection tables, ext. selection tables |
fix_extended_selection_table | add wave objects to extended selection tables | selection tables | extended selection tables |
selection_table | create selection tables and extended selection tables | selection tables | selection tables, ext. selection tables |
song_analysis | measures acoustic parameters at higher structural levels of organization | selection tables, ext. selection tables | data frame, selection tables |
Most warbleR functions are dedicated to quantifying the structure of acoustic signals listed in selection tables using batch processing. For this, 4 main measurement methods are offered:
Most functions gravitate around these methods, or variations of these methods:
Function | Description | Works on | Output |
---|---|---|---|
freq_range | detect frequency range in selection tables | multiple wave files | data frame |
song_analysis | measures acoustic parameters at higher structural levels of organization | selection tables, ext. selection tables | data frame, selection tables |
compare_methods | compare the performance of methods to measure acoustic structure | selection tables, ext. selection tables | images |
freq_DTW | measures dynamic time warping (DTW) on dominant/fundamental frequency contours | selection tables, ext. selection tables | (di)similarity matrix, images |
freq_ts | mesaures dominant/fundamental frequency contours | selection tables, ext. selection tables | data frame with frequency contours |
inflections | measures number of inflections in frequency contours | data frame with frequency contours | data frame |
mfcc_stats | measures statistical descriptors of Mel cepstral coefficients | selection tables, ext. selection tables | data frame |
multi_DTW | measures dynamic time warping (DTW) on multiple contours | selection tables, ext. selection tables | (di)similarity matrix |
sig2noise | measures signal-to-noise ratio | selection tables, ext. selection tables | selection tables, ext. selection tables |
spectro_analysis | measures spectrographic parameters | selection tables, ext. selection tables | data frame |
cross_correlation | measurec spectrographic cross-correlation | selection tables, ext. selection tables | (di)similarity matrix |
Functions are provided to detect inconsistencies in the selection tables or modify selection tables. The package also offers several functions to generate spectrograms showing the annotations, which can be organized by annotation categories. This allows you to verify if the annotations match the previously defined categories, which is particularly useful if the annotations were automatically generated.
Function | Description | Works on | Output |
---|---|---|---|
check_sels | double-check selection tables | selection tables | selection tables |
overlapping_sels | finds (time) overlapping selections | selection tables, ext. selection tables | selection tables, ext. selection tables |
catalog | creates spectrogram catalog | selection tables, ext. selection tables | images |
catalog2pdf | convert catalogs to .pdf | images | images |
spectrograms | create spectrogram images | selection tables, ext. selection tables | images |
full_spectrograms | create spectrograms of whole sound files | multiple wave files, selection tables, ext. selection tables | images |
full_spectrogram2pdf | convert full spectrograms to .pfg | images | images |
Function | Description | Works on | Output |
---|---|---|---|
snr_spectrograms | plots spectrograms highlighting areas where signal-to-noise ratio is measured | selection tables, ext. selection tables | images |
spectrograms | create spectrogram images | selection tables, ext. selection tables | images |
track_freq_contour | create spectrogram images including frequency contours | selection tables, ext. selection tables | images |
plot_coordination | create schematic plots of coordinated signals | data frame | images |
full_spectrograms | create spectrograms of whole sound files | multiple wave files, selection tables, ext. selection tables | images |
Finally, warbleR offers functions to simplify the use of extended selection tables, organize large numbers of images with spectrograms and generate elaborated signal visualizations:
Function | Description | Works on | Output |
---|---|---|---|
is_extended_selection_table | check if object is extended selection tables | data frame | TRUE/FALSE |
is_selection_table | check if object is selection tables | data frame | TRUE/FALSE |
catalog2pdf | convert catalogs to .pdf | images | images |
move_imgs | moves images among folders | images | images |
map_xc | created maps from Xeno-Canto recordings | data frame | images |
test_coordination | test statistical significance of vocal coordination | data frame | data frame |
full_spectrogram2pdf | convert full spectrograms to .pfg | images | images |
color_spectro | highlight signals with colors in a spectrogram | wave object | plot in R |
freq_range_detec | detect frequency range in wave objetcs | wave object | data frame, plot in R |
open_wd | open working directory | ||
phylo_spectro | plots phylogenetic trees with spectrograms | selection tables | plot in R |
read_sound_file | read sound files and wave objects | selection tables, ext. selection tables | wave object |
simulate_songs | simulate songs | wave object, wave file and selection table | |
tweak_spectro | creates mosaic plots with spectrograms with different display parameters | selection tables, ext. selection tables | images |
warbleR_options | define global parameters for warbleR functions |
Session information
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: America/Costa_Rica
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] kableExtra_1.4.0 warbleR_1.1.32 NatureSounds_1.0.4 knitr_1.48 seewave_2.2.3
[6] tuneR_1.4.7
loaded via a namespace (and not attached):
[1] gtable_0.3.5 rjson_0.2.21 xfun_0.46 bslib_0.7.0 ggplot2_3.5.1
[6] htmlwidgets_1.6.4 crosstalk_1.2.1 vctrs_0.6.5 tools_4.3.2 bitops_1.0-7
[11] generics_0.1.3 parallel_4.3.2 tibble_3.2.1 proxy_0.4-27 fansi_1.0.6
[16] highr_0.11 pkgconfig_2.0.3 leaflet_2.2.1 lifecycle_1.0.4 compiler_4.3.2
[21] stringr_1.5.1 brio_1.1.5 munsell_0.5.1 codetools_0.2-18 htmltools_0.5.8.1
[26] maps_3.4.2 sass_0.4.9 RCurl_1.98-1.16 yaml_2.3.9 pillar_1.9.0
[31] jquerylib_0.1.4 MASS_7.3-55 cachem_1.1.0 iterators_1.0.14 viridis_0.6.5
[36] foreach_1.5.2 tidyselect_1.2.1 digest_0.6.36 stringi_1.8.4 dplyr_1.1.4
[41] fastmap_1.2.0 grid_4.3.2 colorspace_2.1-0 cli_3.6.3 magrittr_2.0.3
[46] utf8_1.2.4 scales_1.3.0 shinyBS_0.61.1 rmarkdown_2.27 signal_1.8-1
[51] gridExtra_2.3 pbapply_1.7-2 evaluate_0.24.0 dtw_1.23-1 fftw_1.0-8
[56] testthat_3.2.1.1 viridisLite_0.4.2 rlang_1.1.4 Rcpp_1.0.13 glue_1.7.0
[61] xml2_1.3.6 svglite_2.1.3 rstudioapi_0.16.0 jsonlite_1.8.8 R6_2.5.1
[66] soundgen_2.6.2 systemfonts_1.1.0