library(tuneR)
library(ggridges)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'ggplot2'
## The following object is masked from 'package:ggridges':
## 
##     scale_discrete_manual
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(warbleR)
## Loading required package: maps
## Loading required package: seewave
## 
## Attaching package: 'seewave'
## The following object is masked from 'package:plotly':
## 
##     export
## Loading required package: NatureSounds
## 
## NOTE: functions are being renamed (run 'print(new_function_names)' to see new names). Both old and new names are available in this version 
##  Please see citation('warbleR') for use in publication
Phae.stri <- quer_xc(qword = "nr:154074", download = TRUE, pb = FALSE)

x<-readMP3("Phaethornis-striigularis-154074.mp3")
writeWave(x,"test.wav")
plot(x)

ad <- auto_detec(wl = 200, threshold = 3.5, ssmooth = 1200, bp = c(4, 9.6), 
                 pb = FALSE,  mindur = 0.1, maxdur = 0.25, img = FALSE)
snr <- sig2noise(ad, pb = FALSE, mar = 0.05)

ad <- snr[rank(-snr$SNR) < 60, ]
catalog(ad, nrow = 5, ncol = 4, mar = 0.01, flim = c(3.5, 10.5), 
        labels = "selec", pal = reverse.heat.colors, pb = FALSE)