warbleR logo

Streamlining acoustic analysis

Marcelo Araya-Salas and Grace Smith Vidaurre

Here we present a case study of how warbleR functions can be used for bioacoustics, as well as some tips on managing bioacoustic data in R. For more details about function arguments, input or output, please read the documentation for the function in question (e.g. ?querxc).

Please note that most tools in warbleR use functions from the seewave package internally. warbleR has been designed to make the analyses more accessible to average R-users. However, acoustic analysis in R would not be possible without the tools provided by seewave. Hence, both packages should be given credit when using warbleR and both should be appropriately cited in publications (try citation("warbleR") and citation("seewave")).

This vignette can be run without an advanced understanding of R, as long as you know how to run code in you R console. However, knowing more about data and file manipulation would be very helpful in order to modify the code to fit your own needs.

warbleR workflow

To start, we will use warbleR to download recordings from Xeno-Canto.

Prepare for data collection

First, we need to install and load warbleR. Notice that you need an R version ≥ 2.10 and seewave package version ≥ 2.0.1. Also, users using UNIX machines (Mac OSX or Linux), will need to install fftw3, pkg-config and libsndfile on their machines prior to installing warbleR. These external packages will need to be installed through a UNIX terminal.


And set up a working directory

# Create a new directory

# Check the location of the directory

Obtain metadata and recordings from Xeno-Canto

Next, we can query the Xeno-Canto database for a species or genus of interest. The function querxc has two types of output:

  1. Metadata of recordings: geographic coordinates, recording quality, recorder, type of signal, etc.

  2. Sound files: Sound files (mp3 format) are returned if the argument download is set to TRUE (default is FALSE).

You can query Xeno-Canto by genus:

# Query Xeno-Canto for all recordings of the hummingbird genus Phaethornis
Phae <- querxc(qword = "Phaethornis", download = FALSE) 
## Obtaining recording list...
## 769 recordings found!
# Find out what kind of metadata we have
##  [1] "Recording_ID"      "Genus"             "Specific_epithet" 
##  [4] "Subspecies"        "English_name"      "Recordist"        
##  [7] "Country"           "Locality"          "Latitude"         
## [10] "Longitude"         "Vocalization_type" "Audio_file"       
## [13] "License"           "Url"               "Quality"          
## [16] "Time"              "Date"

Or you can query by species:

# Query Xeno-Canto for all recordings of the species Phaethornis longirostris
Phae.lon <- querxc(qword = "Phaethornis longirostris", download = FALSE) 

If you’re interested in the geographic spread of the recording locations, you can use the function xcmaps to visualize locations. xcmaps will create an image file of a map per species in your current directory if img = TRUE. If img = FALSE, maps will be displayed in the graphic device.

# Image type default is jpeg, but tiff files have better resolution
xcmaps(X = Phae, img = TRUE, it = "tiff") 
xcmaps(X = Phae.lon, img = FALSE)