-
Notifications
You must be signed in to change notification settings - Fork 0
/
intro_to_warbler.qmd
878 lines (483 loc) · 25.2 KB
/
intro_to_warbler.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
---
title: <font size="7"><b>Introduction to warbleR</b></font>
toc: true
toc-depth: 2
toc-location: left
number-sections: true
highlight-style: pygments
format:
html:
df-print: kable
code-fold: show
code-tools: true
css: styles.css
link-external-icon: true
link-external-newwindow: true
---
::: {.alert .alert-info}
## **Objetive** {.unnumbered .unlisted}
- Provide and overview of the must relevant tools in the package warbleR
:::
The [warbleR](https://cran.r-project.org/package=warbleR) package is intended to facilitate the analysis of the structure of 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.
<font size = "4">The main features of the package are:</font>
<font size = "3">
- The use of loops to apply tasks through acoustic signals referenced in a selection table:
<img src="images/loop_warbleR_optim.gif" alt="warbleR measuring loop" width="500"/>
- The production of images files with spectrograms that let users organize data and verify acoustic analyzes: </font>
<img src="images/loop_warbleR_images_optim.gif" alt="warbleR image loop" width="500"/>
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 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:
<img src="images/lifecycle.jpeg" alt="life cycle" width="700"/>
## 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 `check_sels()` 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:
```{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)
# library(kableExtra)
cf <- read.csv("./data/cuadro de funciones warbleR.csv", stringsAsFactors = FALSE)
warbleR_options(wav.path = "./examples")
# options(knitr.table.format = "html")
# opts_chunk$set(comment = "")
# opts_knit$set(root.dir = tempdir())
# options(width = 100, max.print = 100)
```
```{r}
data("lbh_selec_table")
lbh_selec_table
```
... and can be converted to the *selection_table* format like this:
```{r extn_sel_4.32, eval = FALSE}
# global parameters
warbleR_options(wav.path = "./examples")
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)
```
### 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 = "./examples")
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)
```
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.
::: {.alert .alert-info}
<font size="5">Exercise</font>
- Run the example code in the `selection_table()` function documentation
- What do the arguments "mar", "by.song" and "whole.recs" do?
:::
### 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)
```
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)
```
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}
# are they equal?
all.equal(ext_st, ext_st5)
```
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)
```
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)
```
```{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)
}
```
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}
# create new data base
Y <- data.frame(sound.files = ext_st$sound.files, site = "La Selva", lek = c(rep("SUR", 5), rep("CCL", 6)))
# combine
mrg_ext_st <- merge(ext_st, Y, by = "sound.files")
# check class
is_extended_selection_table(mrg_ext_st)
```
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}
# fix
mrg_ext_st <- fix_extended_selection_table(X = mrg_ext_st, Y = ext_st)
# check class
is_extended_selection_table(mrg_ext_st)
```
This works as long as some of the original sound files are retained and no other selections are added.
& nbsp;
### Selection table size
The size of the extended selection box will depend on the number of selections, the sampling rate, the duration of the selection and the length of margins (i.e. additional time you want to keep on each side of the selection). In this example, 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_9, eval=FALSE}
lng.selec.table <- do.call(rbind, replicate(100, lbh_selec_table,
simplify = FALSE))[1:1000,]
lng.selec.table$selec <- 1:nrow(lng.selec.table)
nrow(lng.selec.table)
lng_ext_st <- selection_table(X = lng.selec.table, pb = FALSE,
extended = TRUE, confirm.extended = FALSE)
lng_ext_st
```
```{r extn_sel_9.2, echo=FALSE}
lng.selec.table <- do.call(rbind, replicate(100, lbh_selec_table,
simplify = FALSE))[1:1000,]
lng.selec.table$selec <- 1:nrow(lng.selec.table)
lng_ext_st <- selection_table(X = lng.selec.table, pb = FALSE,
extended = TRUE, confirm.extended = FALSE)
print(lng_ext_st)
```
```{r extn_sel_9.3}
format(object.size(lng_ext_st), units = "auto")
```
As you can see, the object size is only \~ 31 MB. Then, as a guide, a selection box with 1000 selections similar to those of 'lbh_selec_table' (average duration of \~ 0.15 seconds) at a sampling rate of 22.5 kHz and the default margin (mar = 0.1) will generate an extended selection box \~ 31 MB or \~ 310 MB for a selection table of 10,000 rows.
### 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=TRUE}
# spectrographic parameters
sp <- spectro_analysis(ext_st)
sp
```
#### Signal-to-noise ratio
```{r extn_sel_12.5, eval=TRUE}
snr <- sig2noise(ext_st, mar = 0.05)
snr
```
#### Dynamic time warping (DTW)
```{r extn_sel_12.7, eval=FALSE}
dtw.dist <- freq_DTW(ext_st, img = FALSE)
dtw.dist
```
```{r extn_sel_12.8, echo=TRUE}
dtw.dist <- freq_DTW(ext_st, img = FALSE)
as.data.frame(dtw.dist)
```
### 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:
```{r extn_sel_13, out.width= 750, dpi = 100}
# load packages
library(microbenchmark)
library(ggplot2)
# take first 100 selections
mbmrk.snr <- microbenchmark(extended = sig2noise(lng_ext_st[1:100, ],
mar = 0.05), regular = sig2noise(lng.selec.table[1:100, ],
mar = 0.05), times = 50)
autoplot(mbmrk.snr) + ggtitle("sig2noise")
```
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).
### Create selections 'by song'
The extended selection above were made by element. That is, each sound file within the object contains a single selection (that is, a 1: 1 correspondence between the selections and the 'wave' objects). However, extended selection tables can also be created using a higher hierarchical level with the argument `by.song`. In this case, "song" represents a higher level that contains one or more selections and that the user may want to keep together for a particular analysis (for example, the duration of the intervals). The `by.song` argument takes the name of the column of characters or factors with the IDs of the different" songs "within a sound file (note that the function assumes that a given song can only be found in only one sound file, so the selections with the same song ID, but from different sound files are taken as different 'songs').
To create a selection table by song, let's add an artificial song column to our example data in which each of the sound files has 2 songs:
```{r extn_sel_14}
# add column
lbh_selec_table$song <- c(1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 2)
```
The data looks like this:
```{r, extn_sel_15, echo= FALSE}
lbh_selec_table
```
Now we can create an extended selection table 'by song' using the column name 'song' as input for the argument `by.song`:
```{r extn_sel_16}
bs_ext_st <- selection_table(X = lbh_selec_table, extended = TRUE,
confirm.extended = FALSE, by.song = "song")
```
In this case, we should only have 8 'wave' objects instead of 11 as when the object was created 'by selection':
```{r extn_sel_17}
# by element
length(attr(ext_st, "wave.objects"))
# by song
length(attr(bs_ext_st, "wave.objects"))
```
Again, these objects can also be used in any analyzes:
```{r extn_sel_18}
# signal to noise ratio
bs_snr <- sig2noise(bs_ext_st, mar = 0.05)
bs_snr
```
::: {.alert .alert-info}
<font size="5">Exercise</font>
- Compare the size of an extended selection table created by element to that of one created by song using the sample data
:::
### Sharing acoustic data
This new object class allows to share complete data sets, including acoustic data. For example, the following code downloads a subset of the data used in [Araya-Salas *et al* (2017)](https://marceloarayasalas.weebly.com/uploads/2/5/5/2/25524573/araya-salas_smith-vidaurre___webster_2017._table_s1._recording_metadata.xlsx) (can also be downloaded from [here](https://marceloarayasalas.weebly.com/uploads/2/5/5/2/25524573/extended.selection.%20table.araya-salas.et.al.2017.bioacoustics.100.sels.rds)):
```{r extn.sel_19, eval = FALSE}
URL <- "https://github.com/maRce10/OTS_BIR_2023/raw/master/data/extended.selection.table.araya-salas.et.al.2017.bioacoustics.100.sels.rds"
dat <- readRDS(gzcon(url(URL)))
nrow(dat)
format(object.size(dat), units = "auto")
```
```{r extn.sel_19-2, echo = FALSE}
dat <- readRDS("./data/extended.selection.table.araya-salas.et.al.2017.bioacoustics.100.sels.rds")
nrow(dat)
format(object.size(dat), units = "auto")
```
The total size of the 100 sound files from which these selections were taken adds up to 1.1 GB. The size of the extended selection table is only 10.1 MB.
This data is ready to be used:
```{r, eval = TRUE}
sp <- spectro_analysis(dat, bp = c(2, 10))
head(sp)
```
... and the spectrograms can be visualized as follows:
```{r extn.sel_21, out.width= 750}
par(mfrow = c(3, 2), mar = rep(0, 4))
for(i in 1:6){
wv <- read_wave(X = dat, index = i, from = 0.17, to = 0.4)
spectro(wv, wl = 250, grid = FALSE, scale = FALSE, axisX = FALSE,
axisY = FALSE, ovlp = 90, flim = c(0, 12),
palette = reverse.gray.colors.1)
}
```
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.
::: {.alert .alert-info}
<font size="5">Exercise</font>
- Download the extended selection tables of bat social calls from the [this figshare repository](https://figshare.com/articles/dataset/Supplementary_materials_Ontogeny_of_an_interactive_call-and-response_system_in_Spix_s_disc-winged_bats_PART_1/11651772) (scroll till the end of the file list) and create spectrograms for the first 5 selections of each table (either `spectrograms()` or `spectro()` would work)
:::
## **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="images/analysis-workflow.png" alt="analysis workflow"/>
We can group **warbleR** functions according to the bioacoustic analysis stages.
### Get and prepare recordings
The `query_xc()` 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}
cf2 <- cf[cf$Obtener.preparar.grabaciones == "x", c("Function", "Description", "Works.on", "Output")]
cf2$Function <- kableExtra::cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))
kbl <- knitr::kable(cf2, align = "c", row.names = F, format = "html", escape = F)
kbl <- kableExtra::column_spec(kbl, 1, bold = TRUE)
kbl <- kableExtra::column_spec(kbl, 2:4, italic = TRUE)
kbl <- kableExtra::kable_styling(kbl, bootstrap_options = "striped", font_size = 14)
kbl
```
### 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}
cf2 <- cf[cf$Anotar == "x", c("Function", "Description", "Works.on", "Output")]
cf2$Function <- kableExtra::cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))
kbl <- knitr::kable(cf2, align = "c", row.names = F, format = "html", escape = F)
kbl <- kableExtra::column_spec(kbl, 1, bold = TRUE)
kbl <- kableExtra::column_spec(kbl, 2:4, italic = TRUE)
kbl <- kableExtra::kable_styling(kbl, bootstrap_options = "striped", font_size = 14)
kbl
```
### 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}
cf2 <- cf[cf$`Anotar` == "x", c("Function", "Description", "Works.on", "Output")]
cf2$Function <- kableExtra::cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))
kbl <- knitr::kable(cf2, align = "c", row.names = F, format = "html", escape = F)
kbl <- kableExtra::column_spec(kbl, 1, bold = TRUE)
kbl <- kableExtra::column_spec(kbl, 2:4, italic = TRUE)
kbl <- kableExtra::kable_styling(kbl, bootstrap_options = "striped", font_size = 14)
kbl
```
### 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:
```{r, echo = FALSE}
cf2 <- cf[cf$`Medir.estructura` == "x", c("Function", "Description", "Works.on", "Output")]
cf2$Function <- kableExtra::cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))
kbl <- knitr::kable(cf2, align = "c", row.names = F, format = "html", escape = F)
kbl <- kableExtra::column_spec(kbl, 1, bold = TRUE)
kbl <- kableExtra::column_spec(kbl, 2:4, italic = TRUE)
kbl <- kableExtra::kable_styling(kbl, bootstrap_options = "striped", font_size = 14)
kbl
```
::: {.alert .alert-info}
<font size="5">Exercise</font>
- Compare the performance of `spectro_analysis()` on the example 'lbh_selec_table' with "the argument 'fast = TRUE' vs 'fast = FALSE'. What does this argument do and which `seewave` function might be involved?
:::
### 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}
cf2 <- cf[cf$Verificar == "x", c("Function", "Description", "Works.on", "Output")]
cf2$Function <- kableExtra::cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))
kbl <- knitr::kable(cf2, align = "c", row.names = F, format = "html", escape = F)
kbl <- kableExtra::column_spec(kbl, 1, bold = TRUE)
kbl <- kableExtra::column_spec(kbl, 2:4, italic = TRUE)
kbl <- kableExtra::kable_styling(kbl, bootstrap_options = "striped", font_size = 14)
kbl
```
### Visually inspection of annotations and measurements
```{r, echo = FALSE}
cf2 <- cf[cf$`Inspeccion.visual` == "x", c("Function", "Description", "Works.on", "Output")]
cf2$Function <- kableExtra::cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))
kbl <- knitr::kable(cf2, align = "c", row.names = F, format = "html", escape = F)
kbl <- kableExtra::column_spec(kbl, 1, bold = TRUE)
kbl <- kableExtra::column_spec(kbl, 2:4, italic = TRUE)
kbl <- kableExtra::kable_styling(kbl, bootstrap_options = "striped", font_size = 14)
kbl
```
### 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}
cf2 <- cf[cf$Analisis.estadistico == "x" | cf$Otros == "x", c("Function", "Description", "Works.on", "Output")]
cf2$Function <- kableExtra::cell_spec(x = cf2$Function, link = paste0("https://marce10.github.io/warbleR/reference/", cf2$Function, ".html"))
kbl <- knitr::kable(cf2, align = "c", row.names = F, format = "html", escape = F)
kbl <- kableExtra::column_spec(kbl, 1, bold = TRUE)
kbl <- kableExtra::column_spec(kbl, 2:4, italic = TRUE)
kbl <- kableExtra::kable_styling(kbl, bootstrap_options = "striped", font_size = 14)
kbl
```
::: {.alert .alert-info}
<font size="5">Exercise</font>
- Run the examples of the functions `phylo_spectro()` and `color_spectro()`
- Use the `query_xc()` and `map_xc()` functions to explore the geographical distribution of the Xeno-Canto recordings of a species (of bird) of your interest (if any!)
:::
------------------------------------------------------------------------
## 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.
------------------------------------------------------------------------
<font size="4">Session information</font>
```{r session info, echo=F}
sessionInfo()
```