---
title: <center><font size="7"><b>Introduction to warbleR</b></font></center>
pagetitle: Introduction to warbleR
author: 
- <center><a href="http://marceloarayasalas.weebly.com/">Marcelo Araya-Salas, PhD</a> & <a href="http://smith-vidaurre.com/">Grace Smith-Vidaurre</a> </center>
date:  <center>"`r Sys.Date()`"</center>
output:
  rmarkdown::html_document:
    self_contained: yes
    toc: true
    toc_depth: 3
    toc_float:
      collapsed: false
      smooth_scroll: true
vignette: >
  \usepackage[utf8]{inputenc}
  %\VignetteIndexEntry{1. Introduction to warbleR}
  %\VignetteEngine{knitr::rmarkdown}
editor_options: 
  chunk_output_type: console
---

<!-- <script> -->
<!--    $(document).ready(function() { -->
<!--      $head = $('#header'); -->
<!--      $head.prepend('<img src=\"logo.png\"/>') -->
<!--    }); -->
<!-- </script> -->

<!-- &nbsp;  -->


<center>![warbleR logo](logo.png)</center>

&nbsp; 

The [warbleR](https://cran.r-project.org/package=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.

&nbsp;

<font size = "3">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 </font>

&nbsp;

<center><img src = "loop_warbleR_images_optim.gif" alt = "warbleR image loop" width = "500"></center>

&nbsp;


The package offers functions for:

- Browse and download recordings of [Xeno ‐ Canto](http://xeno-canto.org/)
- 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.

&nbsp;

## 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)
1. selection (select)
1. start
1. end

The sample data "lbh_selec_table" contains these columns:
```{r extn_sel_2, echo = FALSE, message = FALSE}

rm(list = ls())

# unload all non-based packages
out <- sapply(paste('package:', names(sessionInfo()$otherPkgs), sep = ""), function(x) try(detach(x, unload = FALSE, character.only = TRUE), silent = T))

#load packages
library(warbleR)
library(knitr)

cf <- read.csv("function_descrip_table.csv", stringsAsFactors = FALSE)


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


warbleR_options(wav.path = tempdir()) 

options(knitr.table.format = "html") 
opts_chunk$set(comment = "")
opts_knit$set(root.dir = tempdir())
options(width = 100, max.print = 100)

```

```{r extn_sel_4.1, eval=FALSE}

data("lbh_selec_table")

lbh_selec_table

```

```{r extn_sel_4.2, echo=FALSE, eval = FALSE}

kbl <- kable(lbh_selec_table, align = "c", row.names = F,  format = "html")

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl <- scroll_box(kbl, width = "740px",
box_css = "border: 1px solid #ddd; padding: 1px; ", extra_css = NULL)

kbl

```

<div style="border: 1px solid #ddd; padding: 1px; overflow-x: scroll; width:740px; "><table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:center;"> sound.files </th>
   <th style="text-align:center;"> channel </th>
   <th style="text-align:center;"> selec </th>
   <th style="text-align:center;"> start </th>
   <th style="text-align:center;"> end </th>
   <th style="text-align:center;"> bottom.freq </th>
   <th style="text-align:center;"> top.freq </th>
   <th style="text-align:center;"> sel.comment </th>
   <th style="text-align:center;"> rec.comment </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:center;"> Phae.long1.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1.1693549 </td>
   <td style="text-align:center;"> 1.3423884 </td>
   <td style="text-align:center;"> 2.220105 </td>
   <td style="text-align:center;"> 8.604378 </td>
   <td style="text-align:center;"> c24 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long1.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 2 </td>
   <td style="text-align:center;"> 2.1584085 </td>
   <td style="text-align:center;"> 2.3214565 </td>
   <td style="text-align:center;"> 2.169437 </td>
   <td style="text-align:center;"> 8.807053 </td>
   <td style="text-align:center;"> c25 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long1.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 3 </td>
   <td style="text-align:center;"> 0.3433366 </td>
   <td style="text-align:center;"> 0.5182553 </td>
   <td style="text-align:center;"> 2.218294 </td>
   <td style="text-align:center;"> 8.756604 </td>
   <td style="text-align:center;"> c26 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long2.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1595983 </td>
   <td style="text-align:center;"> 0.2921692 </td>
   <td style="text-align:center;"> 2.316862 </td>
   <td style="text-align:center;"> 8.822316 </td>
   <td style="text-align:center;"> c27 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long2.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 2 </td>
   <td style="text-align:center;"> 1.4570585 </td>
   <td style="text-align:center;"> 1.5832087 </td>
   <td style="text-align:center;"> 2.284006 </td>
   <td style="text-align:center;"> 8.888027 </td>
   <td style="text-align:center;"> c28 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long3.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.6265520 </td>
   <td style="text-align:center;"> 0.7577715 </td>
   <td style="text-align:center;"> 3.006834 </td>
   <td style="text-align:center;"> 8.822316 </td>
   <td style="text-align:center;"> c29 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long3.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 2 </td>
   <td style="text-align:center;"> 1.9742132 </td>
   <td style="text-align:center;"> 2.1043921 </td>
   <td style="text-align:center;"> 2.776843 </td>
   <td style="text-align:center;"> 8.888027 </td>
   <td style="text-align:center;"> c30 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long3.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 3 </td>
   <td style="text-align:center;"> 0.1233643 </td>
   <td style="text-align:center;"> 0.2545812 </td>
   <td style="text-align:center;"> 2.316862 </td>
   <td style="text-align:center;"> 9.315153 </td>
   <td style="text-align:center;"> c31 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long4.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1.5168116 </td>
   <td style="text-align:center;"> 1.6622365 </td>
   <td style="text-align:center;"> 2.513997 </td>
   <td style="text-align:center;"> 9.216586 </td>
   <td style="text-align:center;"> c32 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long4.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 2 </td>
   <td style="text-align:center;"> 2.9326920 </td>
   <td style="text-align:center;"> 3.0768784 </td>
   <td style="text-align:center;"> 2.579708 </td>
   <td style="text-align:center;"> 10.235116 </td>
   <td style="text-align:center;"> c33 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long4.wav </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 3 </td>
   <td style="text-align:center;"> 0.1453977 </td>
   <td style="text-align:center;"> 0.2904966 </td>
   <td style="text-align:center;"> 2.579708 </td>
   <td style="text-align:center;"> 9.742279 </td>
   <td style="text-align:center;"> c34 </td>
   <td style="text-align:center;"> NA </td>
  </tr>
</tbody>
</table></div>

&nbsp;
 
... and can be converted to the *selection_table* format like this (after saving the corresponding sound files):

```{r extn_sel_4.32, eval = FALSE}

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
```

```{r, eval = TRUE, echo = FALSE}

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

st
```


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:

```{r}

class(st)

```
&nbsp;


### 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:

```{r extn_sel_4.3, eval = FALSE}


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

```

```{r extn_sel_4.33, eval = TRUE, echo = FALSE}

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


```
&nbsp;

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.

&nbsp;
 
### 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*:

```{r extn_sel_5}

is_extended_selection_table(ext_st)

```
&nbsp;

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

```{r extn_sel_6}

ext_st2 <- ext_st[1:2, ]

is_extended_selection_table(ext_st2)

```

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

```{r extn_sel_7}

## print
print(ext_st)

```

... which is equivalent to:

```{r extn_sel_7.1, eval=FALSE}

ext_st

```

```{r extn_sel_7/2, echo=FALSE}

print(ext_st)

```
&nbsp;

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

```{r extn_sel_8, eval = FALSE}

ext_st3 <- ext_st[1:5, ]

ext_st4 <- ext_st[6:11, ]

ext_st5 <- rbind(ext_st3, ext_st4)

#print
ext_st5

```

```{r extn_sel_8.1, echo=FALSE}

ext_st3 <- ext_st[1:5, ]

ext_st4 <- ext_st[6:11, ]

ext_st5 <- rbind(ext_st3, ext_st4)

#print
print(ext_st5)

```

```{r extn_sel_8.2}

# igual q el original
all.equal(ext_st, ext_st5)

```
&nbsp;

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

```{r extn_sel_8.21}

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

```
&nbsp;

These are regular 'wave' objects:

```{r extn_sel_8.22, out.width= 750}

class(wv1)

wv1

spectro(wv1, wl = 150, grid = FALSE, scale = FALSE, ovlp = 90)
```

&nbsp; 

```{r extn_sel_8.23, out.width= 750}
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)

}

```
&nbsp;

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:

```{r extn_sel_8.24}

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

```
&nbsp;

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

```{r extn_sel_8.25}

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

# revisar clase
is_extended_selection_table(mrg_ext_st)

```
&nbsp;

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

&nbsp;
 
### 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

```{r extn_sel_12.1, eval=FALSE}

#  parametros espectrales
sp <- specan(ext_st)

sp
```


```{r, extn_sel_12.2, echo= FALSE, eval = FALSE}

sp <- specan(ext_st)

kbl <- kable(sp, align = "c", row.names = F,  format = "html")

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl <- scroll_box(kbl, width = "740px",
box_css = "border: 1px solid #ddd; padding: 1px; ", extra_css = NULL)

kbl


```

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

&nbsp; 


#### Signal-to-noise ratio

```{r extn_sel_12.5, eval=FALSE}

snr <- sig2noise(ext_st, mar = 0.05)

snr
```


```{r, extn_sel_12.6, echo= FALSE, eval = FALSE}

snr <- sig2noise(ext_st, mar = 0.05)

kbl <- kable(snr, align = "c", row.names = F,  format = "html")

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl <- scroll_box(kbl, width = "740px",
box_css = "border: 1px solid #ddd; padding: 1px; ", extra_css = NULL)

kbl

```

<div style="border: 1px solid #ddd; padding: 1px; overflow-x: scroll; width:740px; "><table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:center;"> sound.files </th>
   <th style="text-align:center;"> channel </th>
   <th style="text-align:center;"> selec </th>
   <th style="text-align:center;"> start </th>
   <th style="text-align:center;"> end </th>
   <th style="text-align:center;"> bottom.freq </th>
   <th style="text-align:center;"> top.freq </th>
   <th style="text-align:center;"> sel.comment </th>
   <th style="text-align:center;"> rec.comment </th>
   <th style="text-align:center;"> SNR </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:center;"> Phae.long1.wav_1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2730334 </td>
   <td style="text-align:center;"> 2.220105 </td>
   <td style="text-align:center;"> 8.604378 </td>
   <td style="text-align:center;"> c24 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 21.18244 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long1.wav_2 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2630480 </td>
   <td style="text-align:center;"> 2.169437 </td>
   <td style="text-align:center;"> 8.807053 </td>
   <td style="text-align:center;"> c25 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 20.35483 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long1.wav_3 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2749187 </td>
   <td style="text-align:center;"> 2.218294 </td>
   <td style="text-align:center;"> 8.756604 </td>
   <td style="text-align:center;"> c26 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 19.16430 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long2.wav_1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2325709 </td>
   <td style="text-align:center;"> 2.316862 </td>
   <td style="text-align:center;"> 8.822316 </td>
   <td style="text-align:center;"> c27 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 23.27315 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long2.wav_2 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2261502 </td>
   <td style="text-align:center;"> 2.284006 </td>
   <td style="text-align:center;"> 8.888027 </td>
   <td style="text-align:center;"> c28 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 26.20566 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long3.wav_1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2312195 </td>
   <td style="text-align:center;"> 3.006834 </td>
   <td style="text-align:center;"> 8.822316 </td>
   <td style="text-align:center;"> c29 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 25.32589 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long3.wav_2 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2301789 </td>
   <td style="text-align:center;"> 2.776843 </td>
   <td style="text-align:center;"> 8.888027 </td>
   <td style="text-align:center;"> c30 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 25.50842 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long3.wav_3 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2312170 </td>
   <td style="text-align:center;"> 2.316862 </td>
   <td style="text-align:center;"> 9.315153 </td>
   <td style="text-align:center;"> c31 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 24.66928 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long4.wav_1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2454249 </td>
   <td style="text-align:center;"> 2.513997 </td>
   <td style="text-align:center;"> 9.216586 </td>
   <td style="text-align:center;"> c32 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 27.62022 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long4.wav_2 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2441864 </td>
   <td style="text-align:center;"> 2.579708 </td>
   <td style="text-align:center;"> 10.235116 </td>
   <td style="text-align:center;"> c33 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 28.85208 </td>
  </tr>
  <tr>
   <td style="text-align:center;"> Phae.long4.wav_3 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 1 </td>
   <td style="text-align:center;"> 0.1 </td>
   <td style="text-align:center;"> 0.2450989 </td>
   <td style="text-align:center;"> 2.579708 </td>
   <td style="text-align:center;"> 9.742279 </td>
   <td style="text-align:center;"> c34 </td>
   <td style="text-align:center;"> NA </td>
   <td style="text-align:center;"> 24.29024 </td>
  </tr>
</tbody>
</table></div>

&nbsp; 

#### Dynamic time warping (DTW)

```{r extn_sel_12.7, eval=FALSE}

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

dtw.dist

```


```{r, extn_sel_12.8, echo= FALSE, eval = FALSE}

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

kbl <- kable(dtw.dist, align = "c", row.names = T,  format = "html")

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl <- scroll_box(kbl, width = "740px",
box_css = "border: 1px solid #ddd; padding: 1px; ", extra_css = NULL)

kbl

```

<div style="border: 1px solid #ddd; padding: 1px; overflow-x: scroll; width:740px; "><table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:left;">   </th>
   <th style="text-align:center;"> Phae.long1.wav_1-1 </th>
   <th style="text-align:center;"> Phae.long1.wav_2-1 </th>
   <th style="text-align:center;"> Phae.long1.wav_3-1 </th>
   <th style="text-align:center;"> Phae.long2.wav_1-1 </th>
   <th style="text-align:center;"> Phae.long2.wav_2-1 </th>
   <th style="text-align:center;"> Phae.long3.wav_1-1 </th>
   <th style="text-align:center;"> Phae.long3.wav_2-1 </th>
   <th style="text-align:center;"> Phae.long3.wav_3-1 </th>
   <th style="text-align:center;"> Phae.long4.wav_1-1 </th>
   <th style="text-align:center;"> Phae.long4.wav_2-1 </th>
   <th style="text-align:center;"> Phae.long4.wav_3-1 </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:left;"> Phae.long1.wav_1-1 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 8.631 </td>
   <td style="text-align:center;"> 4.343 </td>
   <td style="text-align:center;"> 16.633 </td>
   <td style="text-align:center;"> 16.611 </td>
   <td style="text-align:center;"> 13.813 </td>
   <td style="text-align:center;"> 15.675 </td>
   <td style="text-align:center;"> 15.516 </td>
   <td style="text-align:center;"> 18.661 </td>
   <td style="text-align:center;"> 20.886 </td>
   <td style="text-align:center;"> 21.527 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long1.wav_2-1 </td>
   <td style="text-align:center;"> 8.631 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 6.981 </td>
   <td style="text-align:center;"> 22.115 </td>
   <td style="text-align:center;"> 29.123 </td>
   <td style="text-align:center;"> 16.735 </td>
   <td style="text-align:center;"> 22.374 </td>
   <td style="text-align:center;"> 23.024 </td>
   <td style="text-align:center;"> 15.824 </td>
   <td style="text-align:center;"> 16.635 </td>
   <td style="text-align:center;"> 19.549 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long1.wav_3-1 </td>
   <td style="text-align:center;"> 4.343 </td>
   <td style="text-align:center;"> 6.981 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 18.252 </td>
   <td style="text-align:center;"> 20.535 </td>
   <td style="text-align:center;"> 15.206 </td>
   <td style="text-align:center;"> 18.451 </td>
   <td style="text-align:center;"> 16.468 </td>
   <td style="text-align:center;"> 17.262 </td>
   <td style="text-align:center;"> 19.147 </td>
   <td style="text-align:center;"> 21.057 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long2.wav_1-1 </td>
   <td style="text-align:center;"> 16.633 </td>
   <td style="text-align:center;"> 22.115 </td>
   <td style="text-align:center;"> 18.252 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 12.159 </td>
   <td style="text-align:center;"> 10.369 </td>
   <td style="text-align:center;"> 11.213 </td>
   <td style="text-align:center;"> 12.043 </td>
   <td style="text-align:center;"> 12.446 </td>
   <td style="text-align:center;"> 13.535 </td>
   <td style="text-align:center;"> 15.345 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long2.wav_2-1 </td>
   <td style="text-align:center;"> 16.611 </td>
   <td style="text-align:center;"> 29.123 </td>
   <td style="text-align:center;"> 20.535 </td>
   <td style="text-align:center;"> 12.159 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 6.762 </td>
   <td style="text-align:center;"> 5.341 </td>
   <td style="text-align:center;"> 8.698 </td>
   <td style="text-align:center;"> 17.521 </td>
   <td style="text-align:center;"> 20.599 </td>
   <td style="text-align:center;"> 19.272 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long3.wav_1-1 </td>
   <td style="text-align:center;"> 13.813 </td>
   <td style="text-align:center;"> 16.735 </td>
   <td style="text-align:center;"> 15.206 </td>
   <td style="text-align:center;"> 10.369 </td>
   <td style="text-align:center;"> 6.762 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 3.639 </td>
   <td style="text-align:center;"> 4.422 </td>
   <td style="text-align:center;"> 13.252 </td>
   <td style="text-align:center;"> 15.629 </td>
   <td style="text-align:center;"> 15.818 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long3.wav_2-1 </td>
   <td style="text-align:center;"> 15.675 </td>
   <td style="text-align:center;"> 22.374 </td>
   <td style="text-align:center;"> 18.451 </td>
   <td style="text-align:center;"> 11.213 </td>
   <td style="text-align:center;"> 5.341 </td>
   <td style="text-align:center;"> 3.639 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 3.644 </td>
   <td style="text-align:center;"> 13.655 </td>
   <td style="text-align:center;"> 15.946 </td>
   <td style="text-align:center;"> 14.627 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long3.wav_3-1 </td>
   <td style="text-align:center;"> 15.516 </td>
   <td style="text-align:center;"> 23.024 </td>
   <td style="text-align:center;"> 16.468 </td>
   <td style="text-align:center;"> 12.043 </td>
   <td style="text-align:center;"> 8.698 </td>
   <td style="text-align:center;"> 4.422 </td>
   <td style="text-align:center;"> 3.644 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 11.029 </td>
   <td style="text-align:center;"> 13.718 </td>
   <td style="text-align:center;"> 12.458 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long4.wav_1-1 </td>
   <td style="text-align:center;"> 18.661 </td>
   <td style="text-align:center;"> 15.824 </td>
   <td style="text-align:center;"> 17.262 </td>
   <td style="text-align:center;"> 12.446 </td>
   <td style="text-align:center;"> 17.521 </td>
   <td style="text-align:center;"> 13.252 </td>
   <td style="text-align:center;"> 13.655 </td>
   <td style="text-align:center;"> 11.029 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 5.381 </td>
   <td style="text-align:center;"> 5.686 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long4.wav_2-1 </td>
   <td style="text-align:center;"> 20.886 </td>
   <td style="text-align:center;"> 16.635 </td>
   <td style="text-align:center;"> 19.147 </td>
   <td style="text-align:center;"> 13.535 </td>
   <td style="text-align:center;"> 20.599 </td>
   <td style="text-align:center;"> 15.629 </td>
   <td style="text-align:center;"> 15.946 </td>
   <td style="text-align:center;"> 13.718 </td>
   <td style="text-align:center;"> 5.381 </td>
   <td style="text-align:center;"> 0.000 </td>
   <td style="text-align:center;"> 6.102 </td>
  </tr>
  <tr>
   <td style="text-align:left;"> Phae.long4.wav_3-1 </td>
   <td style="text-align:center;"> 21.527 </td>
   <td style="text-align:center;"> 19.549 </td>
   <td style="text-align:center;"> 21.057 </td>
   <td style="text-align:center;"> 15.345 </td>
   <td style="text-align:center;"> 19.272 </td>
   <td style="text-align:center;"> 15.818 </td>
   <td style="text-align:center;"> 14.627 </td>
   <td style="text-align:center;"> 12.458 </td>
   <td style="text-align:center;"> 5.686 </td>
   <td style="text-align:center;"> 6.102 </td>
   <td style="text-align:center;"> 0.000 </td>
  </tr>
</tbody>
</table></div>

&nbsp; 

### 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:

```{r extn_sel_13, eval = FALSE}

# 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")

```
&nbsp;

<center> ![autodetec image example](microbenchmark.png)</center>

&nbsp;


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

&nbsp;

### 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:
  
```{r}

data("Phae.long.est")

Phae.long.est

table(Phae.long.est$lek.song.type)

```

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.

&nbsp;

## **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:

```{r, eval = FALSE, echo = FALSE}

library(warbleR)

wf <- ls("package:warbleR")

wf <- wf[-c(2, 7, 8, 10, 12, 16, 17, 19, 20, 23, 24, 28, 31, 32, 33, 38, 42, 43, 44, 47, 50, 53, 59, 64, 66, 68, 68, 72, 74, 80, 81, 85, 90, 93, 94, 96)]

df <- data.frame(funciones = wf, `Obtener-preparar grabaciones` = "", `Anotar` = "", `Medir` = "",  `Revision` = "", `Inspección visual` = "", `Análisis estadístico` = "", `Otros` = "")

df2 <- edit(df)


df2$`organizar.anotaciones` <- "" 

names(df2) <- names(df2)[c(1:3, 9, 4:8)]

df3 <- edit(df2)

df4 <- df3

df4[is.na(df4)] <- ""

df4 <- df4[df4$Obtener.preparar.grabaciones != "borrar", ]

names(df4) <- c("Función", "Obtener-preparar grabaciones", "Anotar", "Organizar anotaciones", "Medir estructura", "Verificar", "Inspección visual", "Análisis estadístico", "Otros")

rownames(df4) <- 1:nrow(df4)

df5 <- df4[order(df4$`Obtener-preparar grabaciones`, df4$Anotar, df4$`Organizar anotaciones`, df4$`Medir estructura`, df4$Verificar, df4$`Inspección visual`, df4$`Análisis estadístico`, df4$Otros, decreasing = TRUE),]

df4 <- df4[c(5, 8, 18, 29, 34, 35, 37, 38, 39, 55, 56, 26, 1, 19, 40, 46, 4, 11, 16, 17, 24, 25, 32, 41, 45, 7, 12, 13, 14, 15, 23, 27, 30, 42, 47, 48, 57, 2,  3, 28, 44, 50, 51, 52, 58, 9, 10, 21, 22, 59, 6, 20, 31, 33, 36, 43, 49, 53, 54), ]

# write.csv(df4, "cuadro de funciones warbleR.csv", row.names = FALSE)

```

 <img src="analysis-workflow.png" alt="analysis workflow">

&nbsp; 

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

&nbsp;

### Get and prepare recordings

The `querxc()` function allows you to search and download sounds from the free access database [Xeno-Canto](http://xeno-canto.org/). You can also convert .mp3 files to .wav, change the sampling rate of the files and correct corrupt files, among other functions.

```{r, echo = FALSE, eval = FALSE}

library(kableExtra)

names(cf) <- gsub("\\.", " ", names(cf))

cf2 <- cf[cf$`Obtener preparar grabaciones` == "x", c("Function", "Description", "Works on", "Output")]

cf2$Function <- cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))

kbl <- kable(cf2, align = "c", row.names = F,  format = "html", escape = F)

kbl <- column_spec(kbl, 1, bold = TRUE)

kbl <- column_spec(kbl, 2:4, italic = TRUE)

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl

```

<table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:center;"> Function </th>
   <th style="text-align:center;"> Description </th>
   <th style="text-align:center;"> Works on </th>
   <th style="text-align:center;"> Output </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/check_wavs.html" style="     ">check_wavs</a> </td>
   <td style="text-align:center;font-style: italic;"> verify if sound files can be read </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/consolidate.html" style="     ">consolidate</a> </td>
   <td style="text-align:center;font-style: italic;"> consolidate sound files in a single folder </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> data frame and wave files </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/fix_wavs.html" style="     ">fix_wavs</a> </td>
   <td style="text-align:center;font-style: italic;"> fix waves that cannot be read in R </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> wave files </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/mp32wav.html" style="     ">mp32wav</a> </td>
   <td style="text-align:center;font-style: italic;"> convert multiple mp3 files to wav format </td>
   <td style="text-align:center;font-style: italic;"> multiple mp3 files </td>
   <td style="text-align:center;font-style: italic;"> wave files </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/quer_xc.html" style="     ">quer_xc</a> </td>
   <td style="text-align:center;font-style: italic;"> Search and download mp3 files from Xeno-Canto </td>
   <td style="text-align:center;font-style: italic;"> Scientific names/data frame </td>
   <td style="text-align:center;font-style: italic;"> mp3 files </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/resample_est.html" style="     ">resample_est</a> </td>
   <td style="text-align:center;font-style: italic;"> resample wave objects in ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> extended selection tables </td>
   <td style="text-align:center;font-style: italic;"> extended selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/rm_channels.html" style="     ">rm_channels</a> </td>
   <td style="text-align:center;font-style: italic;"> remove channels in multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> wave files </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/rm_sil.html" style="     ">rm_sil</a> </td>
   <td style="text-align:center;font-style: italic;"> remove silences in multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> wave files </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/wav_dur.html" style="     ">wav_dur</a> </td>
   <td style="text-align:center;font-style: italic;"> measures duration in multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/wav_info.html" style="     ">wav_info</a> </td>
   <td style="text-align:center;font-style: italic;"> extract recording parameters from multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
  </tr>
</tbody>
</table>

&nbsp; 



### 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:

```{r, echo = FALSE, eval = FALSE}

cf2 <- cf[cf$Anotar == "x",  c("Function", "Description", "Works on", "Output")]

cf2$Function <- cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))

kbl <- kable(cf2, align = "c", row.names = F,  format = "html", escape = F)

kbl <- column_spec(kbl, 1, bold = TRUE)

kbl <- column_spec(kbl, 2:4, italic = TRUE)

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl

```

<table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:center;"> Function </th>
   <th style="text-align:center;"> Description </th>
   <th style="text-align:center;"> Works on </th>
   <th style="text-align:center;"> Output </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/manual_loc.html" style="     ">manual_loc</a> </td>
   <td style="text-align:center;font-style: italic;"> manual annotation of wave files </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> data frame, .csv file </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/auto_detec.html" style="     ">auto_detec</a> </td>
   <td style="text-align:center;font-style: italic;"> automatic annotation of wave files </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> data frame, images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/freq_range.html" style="     ">freq_range</a> </td>
   <td style="text-align:center;font-style: italic;"> detect frequency range in selection tables </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/sel_tailor.html" style="     ">sel_tailor</a> </td>
   <td style="text-align:center;font-style: italic;"> interactive tailoring of selections </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
  </tr>
</tbody>
</table>

&nbsp; 

### 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*:

```{r, echo = FALSE, eval = FALSE}

cf2 <- cf[cf$`Organizar anotaciones` == "x",  c("Function", "Description", "Works on", "Output")]

cf2$Function <- cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))

kbl <- kable(cf2, align = "c", row.names = F,  format = "html", escape = F)

kbl <- column_spec(kbl, 1, bold = TRUE)

kbl <- column_spec(kbl, 2:4, italic = TRUE)

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl

```

<table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:center;"> Function </th>
   <th style="text-align:center;"> Description </th>
   <th style="text-align:center;"> Works on </th>
   <th style="text-align:center;"> Output </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/sel_tailor.html" style="     ">sel_tailor</a> </td>
   <td style="text-align:center;font-style: italic;"> interactive tailoring of selections </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/sort_colms.html" style="     ">sort_colms</a> </td>
   <td style="text-align:center;font-style: italic;"> order columns in an intuitive way </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/cut_sels.html" style="     ">cut_sels</a> </td>
   <td style="text-align:center;font-style: italic;"> save selections as individual wave files </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
   <td style="text-align:center;font-style: italic;"> wave files </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/filter_sels.html" style="     ">filter_sels</a> </td>
   <td style="text-align:center;font-style: italic;"> subset selection tables based on filtered image files </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables, images </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/fix_extended_selection_table.html" style="     ">fix_extended_selection_table</a> </td>
   <td style="text-align:center;font-style: italic;"> add wave objects to extended selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
   <td style="text-align:center;font-style: italic;"> extended selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/selection_table.html" style="     ">selection_table</a> </td>
   <td style="text-align:center;font-style: italic;"> create selection tables and extended selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/song_param.html" style="     ">song_param</a> </td>
   <td style="text-align:center;font-style: italic;"> measures acoustic parameters at higher structural levels of organization </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> data frame, selection tables </td>
  </tr>
</tbody>
</table>

&nbsp; 

### 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
1. Cross correlation
1. Dynamic time warping (DTW)
1. Statistical descriptors of cepstral coefficients

Most functions gravitate around these methods, or variations of these methods:

```{r, echo = FALSE, eval = FALSE}

cf2 <- cf[cf$`Medir estructura` == "x",  c("Function", "Description", "Works on", "Output")]

cf2$Function <- cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))

kbl <- kable(cf2, align = "c", row.names = F,  format = "html", escape = F)

kbl <- column_spec(kbl, 1, bold = TRUE)

kbl <- column_spec(kbl, 2:4, italic = TRUE)

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl

```

<table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:center;"> Function </th>
   <th style="text-align:center;"> Description </th>
   <th style="text-align:center;"> Works on </th>
   <th style="text-align:center;"> Output </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/freq_range.html" style="     ">freq_range</a> </td>
   <td style="text-align:center;font-style: italic;"> detect frequency range in selection tables </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/song_param.html" style="     ">song_param</a> </td>
   <td style="text-align:center;font-style: italic;"> measures acoustic parameters at higher structural levels of organization </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> data frame, selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/compare_methods.html" style="     ">compare_methods</a> </td>
   <td style="text-align:center;font-style: italic;"> compare the performance of methods to measure acoustic structure </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/dfDTW.html" style="     ">dfDTW</a> </td>
   <td style="text-align:center;font-style: italic;"> measures dynamic time warping (DTW) on dominant frequency contours </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> (di)similarity matrix, images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/dfts.html" style="     ">dfts</a> </td>
   <td style="text-align:center;font-style: italic;"> mesaures dominant frequency contours </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> data frame with frequency contours </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/ffDTW.html" style="     ">ffDTW</a> </td>
   <td style="text-align:center;font-style: italic;"> measures dynamic time warping (DTW) on fundamental frequency contours </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> (di)similarity matrix, images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/ffts.html" style="     ">ffts</a> </td>
   <td style="text-align:center;font-style: italic;"> mesaures fundamental frequency contours </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> data framewith frequency contours </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/inflections.html" style="     ">inflections</a> </td>
   <td style="text-align:center;font-style: italic;"> measures number of inflections in frequency contours </td>
   <td style="text-align:center;font-style: italic;"> data frame with frequency contours </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/mfcc_stats.html" style="     ">mfcc_stats</a> </td>
   <td style="text-align:center;font-style: italic;"> measures statistical descriptors of Mel cepstral coefficients </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/multi_DTW.html" style="     ">multi_DTW</a> </td>
   <td style="text-align:center;font-style: italic;"> measures dynamic time warping (DTW) on multiple contours </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> (di)similarity matrix </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/sig2noise.html" style="     ">sig2noise</a> </td>
   <td style="text-align:center;font-style: italic;"> measures signal-to-noise ratio </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/se_ts.html" style="     ">se_ts</a> </td>
   <td style="text-align:center;font-style: italic;"> measures spectral entropy contours </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> data frame with frequency contours </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/spec_an.html" style="     ">spec_an</a> </td>
   <td style="text-align:center;font-style: italic;"> measures spectrographic parameters </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/x_corr.html" style="     ">x_corr</a> </td>
   <td style="text-align:center;font-style: italic;"> measurec spectrographic cross-correlation </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> (di)similarity matrix </td>
  </tr>
</tbody>
</table>

&nbsp; 

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

```{r, echo = FALSE, eval = FALSE}

cf2 <- cf[cf$Verificar == "x",  c("Function", "Description", "Works on", "Output")]

cf2$Function <- cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))

kbl <- kable(cf2, align = "c", row.names = F,  format = "html", escape = F)

kbl <- column_spec(kbl, 1, bold = TRUE)

kbl <- column_spec(kbl, 2:4, italic = TRUE)

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl

```

<table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:center;"> Function </th>
   <th style="text-align:center;"> Description </th>
   <th style="text-align:center;"> Works on </th>
   <th style="text-align:center;"> Output </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/check_sels.html" style="     ">check_sels</a> </td>
   <td style="text-align:center;font-style: italic;"> double-check selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/ovlp_sels.html" style="     ">ovlp_sels</a> </td>
   <td style="text-align:center;font-style: italic;"> finds (time) overlapping selections </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/catalog.html" style="     ">catalog</a> </td>
   <td style="text-align:center;font-style: italic;"> creates spectrogram catalog </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/catalog2pdf.html" style="     ">catalog2pdf</a> </td>
   <td style="text-align:center;font-style: italic;"> convert catalogs to .pdf </td>
   <td style="text-align:center;font-style: italic;"> images </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/spectrograms.html" style="     ">spectrograms</a> </td>
   <td style="text-align:center;font-style: italic;"> create spectrogram images </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/full_spec.html" style="     ">full_spec</a> </td>
   <td style="text-align:center;font-style: italic;"> create spectrograms of whole sound files </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files, selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/full_spec2pdf.html" style="     ">full_spec2pdf</a> </td>
   <td style="text-align:center;font-style: italic;"> convert full spectrograms to .pfg </td>
   <td style="text-align:center;font-style: italic;"> images </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
</tbody>
</table>

&nbsp; 

### Visually inspection of annotations and measurements

```{r, echo = FALSE, eval = FALSE}

cf2 <- cf[cf$`Inspección visual` == "x",  c("Function", "Description", "Works on", "Output")]

cf2$Function <- cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))

kbl <- kable(cf2, align = "c", row.names = F,  format = "html", escape = F)

kbl <- column_spec(kbl, 1, bold = TRUE)

kbl <- column_spec(kbl, 2:4, italic = TRUE)

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl

```

<table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:center;"> Function </th>
   <th style="text-align:center;"> Description </th>
   <th style="text-align:center;"> Works on </th>
   <th style="text-align:center;"> Output </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/snr_specs.html" style="     ">snr_specs</a> </td>
   <td style="text-align:center;font-style: italic;"> plots spectrograms highlighting areas where signal-to-noise ratio is measured </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/spectrograms.html" style="     ">spectrograms</a> </td>
   <td style="text-align:center;font-style: italic;"> create spectrogram images </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/track_freqs.html" style="     ">track_freqs</a> </td>
   <td style="text-align:center;font-style: italic;"> create spectrogram images including frequency contours </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/coor_graph.html" style="     ">coor_graph</a> </td>
   <td style="text-align:center;font-style: italic;"> create schematic plots of coordinated signals </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/full_spec.html" style="     ">full_spec</a> </td>
   <td style="text-align:center;font-style: italic;"> create spectrograms of whole sound files </td>
   <td style="text-align:center;font-style: italic;"> multiple wave files, selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
</tbody>
</table>
&nbsp; 

### 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:

```{r, echo = FALSE, eval = FALSE}

cf2 <- cf[cf$`Análisis estadístico` == "x" | cf$Otros == "x",  c("Function", "Description", "Works on", "Output")]

cf2$Function <- cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))

kbl <- kable(cf2, align = "c", row.names = F,  format = "html", escape = F)

kbl <- column_spec(kbl, 1, bold = TRUE)

kbl <- column_spec(kbl, 2:4, italic = TRUE)

kbl <-  kable_styling(kbl, bootstrap_options = "striped", font_size = 14)

kbl

```

<table class="table table-striped" style="font-size: 14px; margin-left: auto; margin-right: auto;">
 <thead>
  <tr>
   <th style="text-align:center;"> Function </th>
   <th style="text-align:center;"> Description </th>
   <th style="text-align:center;"> Works on </th>
   <th style="text-align:center;"> Output </th>
  </tr>
 </thead>
<tbody>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/is_extended_selection_table.html" style="     ">is_extended_selection_table</a> </td>
   <td style="text-align:center;font-style: italic;"> check if object is extended selection tables </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
   <td style="text-align:center;font-style: italic;"> TRUE/FALSE </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/is_selection_table.html" style="     ">is_selection_table</a> </td>
   <td style="text-align:center;font-style: italic;"> check if object is selection tables </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
   <td style="text-align:center;font-style: italic;"> TRUE/FALSE </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/catalog2pdf.html" style="     ">catalog2pdf</a> </td>
   <td style="text-align:center;font-style: italic;"> convert catalogs to .pdf </td>
   <td style="text-align:center;font-style: italic;"> images </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/move_imgs.html" style="     ">move_imgs</a> </td>
   <td style="text-align:center;font-style: italic;"> moves images among folders </td>
   <td style="text-align:center;font-style: italic;"> images </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/track_harm.html" style="     ">track_harm</a> </td>
   <td style="text-align:center;font-style: italic;"> measures harmonics with highest energy </td>
   <td style="text-align:center;font-style: italic;"> wave object </td>
   <td style="text-align:center;font-style: italic;"> data frame with frequency contours </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/xc_maps.html" style="     ">xc_maps</a> </td>
   <td style="text-align:center;font-style: italic;"> created maps from Xeno-Canto recordings </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/coor_test.html" style="     ">coor_test</a> </td>
   <td style="text-align:center;font-style: italic;"> test statistical significance of vocal coordination </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
   <td style="text-align:center;font-style: italic;"> data frame </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/full_spec2pdf.html" style="     ">full_spec2pdf</a> </td>
   <td style="text-align:center;font-style: italic;"> convert full spectrograms to .pfg </td>
   <td style="text-align:center;font-style: italic;"> images </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/color_spectro.html" style="     ">color_spectro</a> </td>
   <td style="text-align:center;font-style: italic;"> highlight signals with colors in a spectrogram </td>
   <td style="text-align:center;font-style: italic;"> wave object </td>
   <td style="text-align:center;font-style: italic;"> plot in R </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/freq_range_detec.html" style="     ">freq_range_detec</a> </td>
   <td style="text-align:center;font-style: italic;"> detect frequency range in wave objetcs </td>
   <td style="text-align:center;font-style: italic;"> wave object </td>
   <td style="text-align:center;font-style: italic;"> data frame, plot in R </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/open_wd.html" style="     ">open_wd</a> </td>
   <td style="text-align:center;font-style: italic;"> open working directory </td>
   <td style="text-align:center;font-style: italic;">  </td>
   <td style="text-align:center;font-style: italic;">  </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/phylo_spectro.html" style="     ">phylo_spectro</a> </td>
   <td style="text-align:center;font-style: italic;"> plots phylogenetic trees with spectrograms </td>
   <td style="text-align:center;font-style: italic;"> selection tables </td>
   <td style="text-align:center;font-style: italic;"> plot in R </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/read_wave.html" style="     ">read_wave</a> </td>
   <td style="text-align:center;font-style: italic;"> read wave files and wave objects </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> wave object </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/sim_songs.html" style="     ">sim_songs</a> </td>
   <td style="text-align:center;font-style: italic;"> simulate songs </td>
   <td style="text-align:center;font-style: italic;">  </td>
   <td style="text-align:center;font-style: italic;"> wave object, wave file and selection table </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/spec_param.html" style="     ">spec_param</a> </td>
   <td style="text-align:center;font-style: italic;"> creates mosaic plots with spectrograms with different display parameters </td>
   <td style="text-align:center;font-style: italic;"> selection tables, ext. selection tables </td>
   <td style="text-align:center;font-style: italic;"> images </td>
  </tr>
  <tr>
   <td style="text-align:center;font-weight: bold;"> <a href="https://marce10.github.io/warbleR/reference/warbleR_options.html" style="     ">warbleR_options</a> </td>
   <td style="text-align:center;font-style: italic;"> define global parameters for warbleR functions </td>
   <td style="text-align:center;font-style: italic;">  </td>
   <td style="text-align:center;font-style: italic;">  </td>
  </tr>
</tbody>
</table>

&nbsp;

---


## 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
1. Araya-Salas M, Smith-Vidaurre G (2017) warbleR: An R package to streamline analysis of animal acoustic signals. Methods Ecol Evol 8:184–191.

&nbsp; 

---

<font size="4">Session information</font>

```{r session info, echo=F}

sessionInfo()

```
