warbleR logo

 

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 use of loops to apply tasks through acoustic signals referenced in a selection table
  • The production of image files with spectrograms that let users organize data and verify acoustic analyzes

 

warbleR image loop

 

The package offers functions for:

  • Browse and download recordings of Xeno ‐ Canto
  • Explore, organize and manipulate multiple sound files
  • Detect signals automatically (in frequency and time)
  • Create spectrograms of complete recordings or individual signals
  • Run different measures of acoustic signal structure
  • Evaluate the performance of measurement methods
  • Catalog signals
  • Characterize different structural levels in acoustic signals
  • Statistical analysis of duet coordination
  • Consolidate databases and annotation tables

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.

 

Selection tables

These objects are created with the selection_table() function. The function takes data frames containing selection data (name of the sound file, selection, start, end …), verifies if the information is consistent (see the function checksels() for details) and saves the ‘diagnostic’ metadata as an attribute. The selection tables are basically data frames in which the information contained has been corroborated so it can be read by other warbleR functions. The selection tables must contain (at least) the following columns:

  1. sound files (sound.files)
  2. selection (select)
  3. start
  4. end

The sample data “lbh_selec_table” contains these columns:

data("lbh_selec_table")

lbh_selec_table
sound.files channel selec start end bottom.freq top.freq sel.comment rec.comment
Phae.long1.wav 1 1 1.1693549 1.3423884 2.220105 8.604378 c24 NA
Phae.long1.wav 1 2 2.1584085 2.3214565 2.169437 8.807053 c25 NA
Phae.long1.wav 1 3 0.3433366 0.5182553 2.218294 8.756604 c26 NA
Phae.long2.wav 1 1 0.1595983 0.2921692 2.316862 8.822316 c27 NA
Phae.long2.wav 1 2 1.4570585 1.5832087 2.284006 8.888027 c28 NA
Phae.long3.wav 1 1 0.6265520 0.7577715 3.006834 8.822316 c29 NA
Phae.long3.wav 1 2 1.9742132 2.1043921 2.776843 8.888027 c30 NA
Phae.long3.wav 1 3 0.1233643 0.2545812 2.316862 9.315153 c31 NA
Phae.long4.wav 1 1 1.5168116 1.6622365 2.513997 9.216586 c32 NA
Phae.long4.wav 1 2 2.9326920 3.0768784 2.579708 10.235116 c33 NA
Phae.long4.wav 1 3 0.1453977 0.2904966 2.579708 9.742279 c34 NA

 

… and can be converted to the selection_table format like this (after saving the corresponding sound files):

data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4"))
writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav"))
writeWave(Phae.long2, file.path(tempdir(), "Phae.long2.wav"))
writeWave(Phae.long3, file.path(tempdir(), "Phae.long3.wav"))
writeWave(Phae.long4, file.path(tempdir(), "Phae.long4.wav")) 

# parametros globales
warbleR_options(wav.path = tempdir())

st <- selection_table(X = lbh_selec_table, pb = FALSE)

st
all selections are OK 
object of class 'selection_table' 
 contains a selection table data frame with 11 rows and 9 columns: 
     sound.files channel selec     start       end bottom.freq top.freq sel.comment rec.comment
1 Phae.long1.wav       1     1 1.1693549 1.3423884    2.220105 8.604378         c24          NA
2 Phae.long1.wav       1     2 2.1584085 2.3214565    2.169437 8.807053         c25          NA
3 Phae.long1.wav       1     3 0.3433366 0.5182553    2.218294 8.756604         c26          NA
4 Phae.long2.wav       1     1 0.1595983 0.2921692    2.316862 8.822316         c27          NA
5 Phae.long2.wav       1     2 1.4570585 1.5832087    2.284006 8.888027         c28          NA
6 Phae.long3.wav       1     1 0.6265520 0.7577715    3.006834 8.822316         c29          NA
... and 5 more rows 
and a data frame (check.results) generated by check_sels() (as attribute) 
created by warbleR 1.1.24

Note that the path to the sound files has been provided. This is necessary in order to verify that the data provided conforms to the characteristics of the audio files.

Selection tables have their own class in R:

class(st)
[1] "selection_table" "data.frame"     

 

Extended selection tables

When the extended = TRUE argument the function generates an object of the extended_selection_table class that also contains a list of ‘wave’ objects corresponding to each of the selections in the data. Therefore, the function transforms the selection table into self-contained objects since the original sound files are no longer needed to perform most of the acoustic analysis in warbleR. This can greatly facilitate the storage and exchange of (bio)acoustic data. In addition, it also speeds up analysis, since it is not necessary to read the sound files every time the data is analyzed.

Now, as mentioned earlier, you need the selection_table() function to create an extended selection table. You must also set the argument extended = TRUE (otherwise, the class would be a selection table). The following code converts the sample data into an extended selection table:

#  global parameters
warbleR_options(wav.path = "PONER RUTA A 'ejemplos' AQUI")


ext_st <- selection_table(X = lbh_selec_table, pb = FALSE, 
          extended = TRUE, confirm.extended = FALSE)
all selections are OK 

 

And that is. Now the acoustic data and the selection data (as well as the additional metadata) are all together in a single R object.

 

Handling extended selection tables

Several functions can be used to deal with objects of this class. You can test if the object belongs to the extended_selection_table:

is_extended_selection_table(ext_st)
[1] TRUE

 

You can subset the selection in the same way that any other data frame and it will still keep its attributes:

ext_st2 <- ext_st[1:2, ]

is_extended_selection_table(ext_st2)
[1] TRUE

There is also a generic version of print() for this class of objects:

## print
print(ext_st)
object of class 'extended_selection_table' 
 contains a selection table data frame with 11 rows and 9 columns: 
       sound.files channel selec start       end bottom.freq top.freq sel.comment rec.comment
1 Phae.long1.wav_1       1     1   0.1 0.2730334    2.220105 8.604378         c24          NA
2 Phae.long1.wav_2       1     1   0.1 0.2630480    2.169437 8.807053         c25          NA
3 Phae.long1.wav_3       1     1   0.1 0.2749187    2.218294 8.756604         c26          NA
4 Phae.long2.wav_1       1     1   0.1 0.2325709    2.316862 8.822316         c27          NA
5 Phae.long2.wav_2       1     1   0.1 0.2261502    2.284006 8.888027         c28          NA
6 Phae.long3.wav_1       1     1   0.1 0.2312195    3.006834 8.822316         c29          NA
... and 5 more rows 
11 wave objects (as attributes): 
[1] "Phae.long1.wav_1" "Phae.long1.wav_2" "Phae.long1.wav_3" "Phae.long2.wav_1" "Phae.long2.wav_2"
[6] "Phae.long3.wav_1"
... and 5 more 
and a data frame (check.results) generated by check_sels() (as attribute) 
the selection table was created by element (see 'class_extended_selection_table') 
1 sampling rate(s): 22.5 
1 bit depth(s): 16 
created by warbleR 1.1.24

… which is equivalent to:

ext_st
object of class 'extended_selection_table' 
 contains a selection table data frame with 11 rows and 9 columns: 
       sound.files channel selec start       end bottom.freq top.freq sel.comment rec.comment
1 Phae.long1.wav_1       1     1   0.1 0.2730334    2.220105 8.604378         c24          NA
2 Phae.long1.wav_2       1     1   0.1 0.2630480    2.169437 8.807053         c25          NA
3 Phae.long1.wav_3       1     1   0.1 0.2749187    2.218294 8.756604         c26          NA
4 Phae.long2.wav_1       1     1   0.1 0.2325709    2.316862 8.822316         c27          NA
5 Phae.long2.wav_2       1     1   0.1 0.2261502    2.284006 8.888027         c28          NA
6 Phae.long3.wav_1       1     1   0.1 0.2312195    3.006834 8.822316         c29          NA
... and 5 more rows 
11 wave objects (as attributes): 
[1] "Phae.long1.wav_1" "Phae.long1.wav_2" "Phae.long1.wav_3" "Phae.long2.wav_1" "Phae.long2.wav_2"
[6] "Phae.long3.wav_1"
... and 5 more 
and a data frame (check.results) generated by check_sels() (as attribute) 
the selection table was created by element (see 'class_extended_selection_table') 
1 sampling rate(s): 22.5 
1 bit depth(s): 16 
created by warbleR 1.1.24

 

You can also join them in rows. Here the original extended_selection_table is divided into 2 and bound again using rbind():

ext_st3 <- ext_st[1:5, ]

ext_st4 <- ext_st[6:11, ]

ext_st5 <- rbind(ext_st3, ext_st4)

#print
ext_st5
object of class 'extended_selection_table' 
 contains a selection table data frame with 11 rows and 9 columns: 
       sound.files channel selec start       end bottom.freq top.freq sel.comment rec.comment
1 Phae.long1.wav_1       1     1   0.1 0.2730334    2.220105 8.604378         c24          NA
2 Phae.long1.wav_2       1     1   0.1 0.2630480    2.169437 8.807053         c25          NA
3 Phae.long1.wav_3       1     1   0.1 0.2749187    2.218294 8.756604         c26          NA
4 Phae.long2.wav_1       1     1   0.1 0.2325709    2.316862 8.822316         c27          NA
5 Phae.long2.wav_2       1     1   0.1 0.2261502    2.284006 8.888027         c28          NA
6 Phae.long3.wav_1       1     1   0.1 0.2312195    3.006834 8.822316         c29          NA
... and 5 more rows 
11 wave objects (as attributes): 
[1] "Phae.long1.wav_1" "Phae.long1.wav_2" "Phae.long1.wav_3" "Phae.long2.wav_1" "Phae.long2.wav_2"
[6] "Phae.long3.wav_1"
... and 5 more 
and a data frame (check.results) generated by check_sels() (as attribute) 
the selection table was created by element (see 'class_extended_selection_table') 
1 sampling rate(s): 22.5 
1 bit depth(s): 16 
created by warbleR 1.1.24
# igual q el original
all.equal(ext_st, ext_st5)
[1] TRUE

 

The ‘wave’ objects can be read individually using read_wave(), a wrapper for the readWave() function of tuneR, which can handle extended selection tables:

wv1 <- read_wave(X = ext_st, index = 3, from = 0, to = 0.37)

 

These are regular ‘wave’ objects:

class(wv1)
[1] "Wave"
attr(,"package")
[1] "tuneR"
wv1

Wave Object
    Number of Samples:      8325
    Duration (seconds):     0.37
    Samplingrate (Hertz):   22500
    Channels (Mono/Stereo): Mono
    PCM (integer format):   TRUE
    Bit (8/16/24/32/64):    16 
spectro(wv1, wl = 150, grid = FALSE, scale = FALSE, ovlp = 90)

 

par(mfrow = c(3, 2), mar = rep(0, 4))

for(i in 1:6){
  
  wv <- read_wave(X = ext_st, index = i, from = 0.05, to = 0.32)

  spectro(wv, wl = 150, grid = FALSE, scale = FALSE, axisX = FALSE,
          axisY = FALSE, ovlp = 90)

}

 

The read_wave() function requires the selection table, as well as the row index (i.e. the row number) to be able to read the ‘wave’ objects. It can also read a regular ‘wave’ file if the path is provided.

Note that other functions that modify data frames are likely to delete the attributes in which the ‘wave’ objects and metadata are stored. For example, the merge and the extended selection box will remove its attributes:

# crear nueva base de datos
Y <- data.frame(sound.files = ext_st$sound.files, site = "La Selva", lek = c(rep("SUR", 5), rep("CCL", 6)))

# combinar
mrg_ext_st <- merge(ext_st, Y, by = "sound.files")

# revisar clase
is_extended_selection_table(mrg_ext_st)
[1] FALSE

 

In this case, we can use the fix_extended_selection_table() function to transfer the attributes of the original extended selection table:

# arreglar
mrg_ext_st <- fix_extended_selection_table(X = mrg_ext_st, Y = ext_st)

# revisar clase
is_extended_selection_table(mrg_ext_st)
[1] TRUE

 

This works as long as some of the original sound files are retained and no other selections are added.

 

Analysis using extended selection tables

These objects can be used as input for most warbleR functions. Here are some examples of warbleR functions using extended_selection_table:

Spectral parameters

#  parametros espectrales
sp <- specan(ext_st)

sp
sound.files selec top.freq bottom.freq duration meanfreq sd freq.median freq.Q25 freq.Q75 freq.IQR time.median time.Q25 time.Q75 time.IQR skew kurt sp.ent time.ent entropy sfm meandom mindom maxdom dfrange modindx startdom enddom dfslope meanpeakf
Phae.long1.wav_1 1 8.604378 2.220105 0.1730334 5.982409 1.399784 6.331716 5.296584 6.869521 1.572937 0.0798769 0.0532513 0.1198154 0.0665641 1.997847 7.021611 0.9434481 0.9493305 0.8956441 0.6510917 6.663993 5.251465 7.360840 2.109375 2.895833 7.316895 7.185059 -0.7619101 7.108806
Phae.long1.wav_2 1 8.807053 2.169437 0.1630480 5.996627 1.424418 6.212125 5.328746 6.880795 1.552049 0.0815556 0.0407778 0.1223333 0.0815556 1.922889 7.349165 0.9467605 0.9536171 0.9028469 0.6693779 6.830116 5.295410 8.283691 2.988281 2.661765 7.185059 7.229004 0.2695238 6.931635
Phae.long1.wav_3 1 8.756604 2.218294 0.1749187 6.020840 1.516065 6.428439 5.152811 6.983309 1.830498 0.0942188 0.0538393 0.1345983 0.0807590 2.488671 11.088694 0.9448412 0.9516042 0.8991149 0.6688752 6.770717 4.899902 8.371582 3.471680 3.240506 7.185059 7.185059 0.0000000 6.798757
Phae.long2.wav_1 1 8.822316 2.316862 0.1325709 6.400285 1.340337 6.595971 5.607323 7.380852 1.773529 0.0736790 0.0589432 0.1031506 0.0442074 1.576807 6.067438 0.9429749 0.9433199 0.8895270 0.6113456 6.341309 5.075684 7.404785 2.329102 2.830189 5.075684 6.657715 11.9334722 7.463147
Phae.long2.wav_2 1 8.888027 2.284006 0.1261502 6.312574 1.370680 6.602020 5.609829 7.213209 1.603380 0.0841185 0.0560790 0.0981383 0.0420593 2.471692 10.897781 0.9361034 0.9436550 0.8833586 0.6202855 6.411621 5.075684 7.580566 2.504883 2.087719 5.075684 7.580566 19.8563528 6.710171
Phae.long3.wav_1 1 8.822316 3.006834 0.1312195 6.612029 1.093231 6.670130 6.067212 7.349366 1.282153 0.0583309 0.0437481 0.1020790 0.0583309 1.773862 6.626284 0.9302604 0.9460368 0.8800605 0.5703286 6.481934 4.899902 7.009277 2.109375 1.520833 4.899902 6.965332 15.7402610 6.710171
Phae.long3.wav_2 1 8.888027 2.776843 0.1301789 6.641352 1.117488 6.674164 6.105325 7.419806 1.314481 0.0723457 0.0434074 0.1012840 0.0578765 1.552445 5.072432 0.9234823 0.9490107 0.8763946 0.5323566 6.244629 5.031738 6.701660 1.669922 1.368421 5.031738 6.613770 12.1527447 6.665879
Phae.long3.wav_3 1 9.315153 2.316862 0.1312170 6.587994 1.253397 6.654583 6.037086 7.394054 1.356967 0.0583309 0.0437481 0.1020790 0.0583309 1.804727 5.989106 0.9198633 0.9533711 0.8769711 0.5311599 6.231445 5.427246 6.833496 1.406250 1.656250 5.471191 6.657715 9.0424551 6.710171
Phae.long4.wav_1 1 9.216586 2.513997 0.1454249 6.223265 1.478895 6.236892 5.459282 7.310408 1.851126 0.0872800 0.0436400 0.1163733 0.0727333 1.250661 4.286583 0.9641781 0.9520208 0.9179176 0.7580285 6.270197 5.119629 7.844238 2.724609 2.709677 5.383301 6.262207 6.0437118 6.222951
Phae.long4.wav_2 1 10.235116 2.579708 0.1441864 6.469164 1.592056 6.334537 5.633543 7.583833 1.950290 0.0865333 0.0432667 0.1153778 0.0721111 1.697660 6.403873 0.9583776 0.9526137 0.9129636 0.7212134 6.294167 4.108887 8.151855 4.042969 2.478261 5.427246 4.108887 -9.1434347 6.222951
Phae.long4.wav_3 1 9.742279 2.579708 0.1450989 6.123725 1.543169 6.081716 5.178639 7.246754 2.068115 0.0870933 0.0435467 0.1161244 0.0725778 1.090784 4.106009 0.9643391 0.9536831 0.9196739 0.7370873 6.150346 4.943848 7.888184 2.944336 3.149254 5.339355 5.031738 -2.1200514 5.912903

 

Signal-to-noise ratio

snr <- sig2noise(ext_st, mar = 0.05)

snr
sound.files channel selec start end bottom.freq top.freq sel.comment rec.comment SNR
Phae.long1.wav_1 1 1 0.1 0.2730334 2.220105 8.604378 c24 NA 21.18244
Phae.long1.wav_2 1 1 0.1 0.2630480 2.169437 8.807053 c25 NA 20.35483
Phae.long1.wav_3 1 1 0.1 0.2749187 2.218294 8.756604 c26 NA 19.16430
Phae.long2.wav_1 1 1 0.1 0.2325709 2.316862 8.822316 c27 NA 23.27315
Phae.long2.wav_2 1 1 0.1 0.2261502 2.284006 8.888027 c28 NA 26.20566
Phae.long3.wav_1 1 1 0.1 0.2312195 3.006834 8.822316 c29 NA 25.32589
Phae.long3.wav_2 1 1 0.1 0.2301789 2.776843 8.888027 c30 NA 25.50842
Phae.long3.wav_3 1 1 0.1 0.2312170 2.316862 9.315153 c31 NA 24.66928
Phae.long4.wav_1 1 1 0.1 0.2454249 2.513997 9.216586 c32 NA 27.62022
Phae.long4.wav_2 1 1 0.1 0.2441864 2.579708 10.235116 c33 NA 28.85208
Phae.long4.wav_3 1 1 0.1 0.2450989 2.579708 9.742279 c34 NA 24.29024

 

Dynamic time warping (DTW)

dtw.dist <- dfDTW(ext_st, img = FALSE)

dtw.dist
Phae.long1.wav_1-1 Phae.long1.wav_2-1 Phae.long1.wav_3-1 Phae.long2.wav_1-1 Phae.long2.wav_2-1 Phae.long3.wav_1-1 Phae.long3.wav_2-1 Phae.long3.wav_3-1 Phae.long4.wav_1-1 Phae.long4.wav_2-1 Phae.long4.wav_3-1
Phae.long1.wav_1-1 0.000 8.631 4.343 16.633 16.611 13.813 15.675 15.516 18.661 20.886 21.527
Phae.long1.wav_2-1 8.631 0.000 6.981 22.115 29.123 16.735 22.374 23.024 15.824 16.635 19.549
Phae.long1.wav_3-1 4.343 6.981 0.000 18.252 20.535 15.206 18.451 16.468 17.262 19.147 21.057
Phae.long2.wav_1-1 16.633 22.115 18.252 0.000 12.159 10.369 11.213 12.043 12.446 13.535 15.345
Phae.long2.wav_2-1 16.611 29.123 20.535 12.159 0.000 6.762 5.341 8.698 17.521 20.599 19.272
Phae.long3.wav_1-1 13.813 16.735 15.206 10.369 6.762 0.000 3.639 4.422 13.252 15.629 15.818
Phae.long3.wav_2-1 15.675 22.374 18.451 11.213 5.341 3.639 0.000 3.644 13.655 15.946 14.627
Phae.long3.wav_3-1 15.516 23.024 16.468 12.043 8.698 4.422 3.644 0.000 11.029 13.718 12.458
Phae.long4.wav_1-1 18.661 15.824 17.262 12.446 17.521 13.252 13.655 11.029 0.000 5.381 5.686
Phae.long4.wav_2-1 20.886 16.635 19.147 13.535 20.599 15.629 15.946 13.718 5.381 0.000 6.102
Phae.long4.wav_3-1 21.527 19.549 21.057 15.345 19.272 15.818 14.627 12.458 5.686 6.102 0.000

 

Performance

The use of extended_selection_table objects can improve performance (in our case, measured as time). Here we use microbenchmark to compare the performance of sig2noise() and ggplot2 to plot the results. First, a selection table with 1000 selections is created simply by repeating the sample data frame several times and then is converted to an extended selection table:

# create long selection table
lng.selec.table <- do.call(rbind, replicate(10, lbh_selec_table, 
                        simplify = FALSE))

# relabels selec
lng.selec.table$selec <- 1:nrow(lng.selec.table)

# create extended selection table
lng_ext_st <- selection_table(X = lng.selec.table, pb = FALSE, 
                        extended = TRUE, confirm.extended = FALSE)


# load packages
library(microbenchmark)
library(ggplot2)

# check performance
mbmrk.snr <- microbenchmark(extended = sig2noise(lng_ext_st, 
      mar = 0.05), regular = sig2noise(lng.selec.table, 
                    mar = 0.05), times = 50)

autoplot(mbmrk.snr) + ggtitle("sig2noise")

 

autodetec image example

 

The function runs much faster in the extended selection tables. Performance gain is likely to improve when longer recordings and data sets are used (that is, to compensate for computing overhead).

 

Sharing acoustic data

This new object class allows to share complete data sets, including acoustic data. For example, the NatureSounds package contains an extended selection table with long-billed hermit hummingbirds vocalizations from 10 different song types:

data("Phae.long.est")

Phae.long.est
object of class 'extended_selection_table' 
 contains a selection table data frame with 50 rows and 8 columns: 
  sound.files selec start       end bottom.freq top.freq lek lek.song.type
1    BR2-A1-1     1   0.1 0.2676122    1.601978 10.95248 BR2        BR2-A1
2    BR2-A1-2     1   0.1 0.2652138    1.891390 11.02500 BR2        BR2-A1
3    BR2-A1-3     1   0.1 0.2716211    1.717743 11.02500 BR2        BR2-A1
4    BR2-A1-4     1   0.1 0.2700891    1.833508 11.02500 BR2        BR2-A1
5    BR2-A1-5     1   0.1 0.2769735    2.122920 11.02500 BR2        BR2-A1
6    CCE-I3-1     1   0.1 0.2489883    1.755128 11.02500 CCE        CCE-I3
... and 44 more rows 
50 wave objects (as attributes): 
[1] "BR2-A1-1" "BR2-A1-2" "BR2-A1-3" "BR2-A1-4" "BR2-A1-5" "CCE-I3-1"
... and 44 more 
and a data frame (check.results) generated by check_sels() (as attribute) 
the selection table was created by element (see 'class_extended_selection_table') 
1 sampling rate(s): 22.05 
1 bit depth(s): 8 
created by warbleR < 1.1.21
table(Phae.long.est$lek.song.type)

BR2-A1 CCE-I3 LOC-D1 SAT-F1 STR-A2 SUR-E1 SUR-K4 TR1-C2 TR1-C5 TR1-D4 
     5      5      5      5      5      5      5      5      5      5 

The ability to compress large data sets and the ease of performing analyzes that require a single R object can simplify the exchange of data and the reproducibility of bioacoustic analyzes.

 

warbleR functions and the workflow of analysis in bioacoustics

Bioacoustic analyzes generally follow a specific processing sequence and analysis. This sequence can be represented schematically like this:

analysis workflow

 

We can group warbleR functions according to the bioacoustic analysis stages.

 

Get and prepare recordings

The querxc() 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_wavs 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
quer_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
rm_channels remove channels in multiple wave files multiple wave files wave files
rm_sil remove silences in multiple wave files multiple wave files wave files
wav_dur measures duration in multiple wave files multiple wave files data frame
wav_info extract recording parameters from multiple wave files multiple wave files data frame

 

Annotating sound

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
manual_loc manual annotation of wave files multiple wave files data frame, .csv file
auto_detec automatic annotation of wave files multiple wave files data frame, images
freq_range detect frequency range in selection tables multiple wave files data frame
sel_tailor interactive tailoring of selections selection tables selection tables

 

Organize annotations

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
sel_tailor 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_param measures acoustic parameters at higher structural levels of organization selection tables, ext. selection tables data frame, selection tables

 

Measure acoustic signal structure

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:

  1. Spectrographic parameters
  2. Cross correlation
  3. Dynamic time warping (DTW)
  4. Statistical descriptors of cepstral coefficients

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_param 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
dfDTW measures dynamic time warping (DTW) on dominant frequency contours selection tables, ext. selection tables (di)similarity matrix, images
dfts mesaures dominant frequency contours selection tables, ext. selection tables data frame with frequency contours
ffDTW measures dynamic time warping (DTW) on fundamental frequency contours selection tables, ext. selection tables (di)similarity matrix, images
ffts mesaures fundamental frequency contours selection tables, ext. selection tables data framewith 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
se_ts measures spectral entropy contours selection tables, ext. selection tables data frame with frequency contours
spec_an measures spectrographic parameters selection tables, ext. selection tables data frame
x_corr measurec spectrographic cross-correlation selection tables, ext. selection tables (di)similarity matrix

 

Verify annotations

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
ovlp_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_spec create spectrograms of whole sound files multiple wave files, selection tables, ext. selection tables images
full_spec2pdf convert full spectrograms to .pfg images images

 

Visually inspection of annotations and measurements

Function Description Works on Output
snr_specs 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_freqs create spectrogram images including frequency contours selection tables, ext. selection tables images
coor_graph create schematic plots of coordinated signals data frame images
full_spec create spectrograms of whole sound files multiple wave files, selection tables, ext. selection tables images

 

Additional functions

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
track_harm measures harmonics with highest energy wave object data frame with frequency contours
xc_maps created maps from Xeno-Canto recordings data frame images
coor_test test statistical significance of vocal coordination data frame data frame
full_spec2pdf 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_wave read wave files and wave objects selection tables, ext. selection tables wave object
sim_songs simulate songs wave object, wave file and selection table
spec_param creates mosaic plots with spectrograms with different display parameters selection tables, ext. selection tables images
warbleR_options define global parameters for warbleR functions

 


References

  1. Araya-Salas M, G Smith-Vidaurre & M Webster. 2017. Assessing the effect of sound file compression and background noise on measures of acoustic signal structure. Bioacoustics 4622, 1–17
  2. Araya-Salas M, Smith-Vidaurre G (2017) warbleR: An R package to streamline analysis of animal acoustic signals. Methods Ecol Evol 8:184–191.

 


Session information

R version 4.0.1 (2020-06-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=es_CR.UTF-8       
 [4] LC_COLLATE=C               LC_MONETARY=es_CR.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=es_CR.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=es_CR.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] warbleR_1.1.24     NatureSounds_1.0.3 knitr_1.29         seewave_2.1.6      tuneR_1.3.3       

loaded via a namespace (and not attached):
 [1] dtw_1.21-3      fftw_1.0-6      digest_0.6.25   bitops_1.0-6    MASS_7.3-51.6   signal_0.7-6   
 [7] magrittr_1.5    evaluate_0.14   pbapply_1.4-2   rlang_0.4.6     stringi_1.4.6   rmarkdown_2.3  
[13] rjson_0.2.20    tools_4.0.1     stringr_1.4.0   RCurl_1.98-1.2  proxy_0.4-24    parallel_4.0.1 
[19] xfun_0.15       yaml_2.2.1      compiler_4.0.1  htmltools_0.5.0