Programming allows to do custom made analyses that better fit the research questions and the characteristics of the signals. This blog aims to create a space for sharing case-specific acoustic analysis routines as well as overviews of new available tools, aiming to diversify the toolkit of the bioacoustics research community.
The R package dynaSpec can now be installed from github. This is a set of tools to generate dynamic spectrogram visualizations in video format. It is still on the making and new visualizations will be available soon. FFMPEG must be installed in order for this package to work.
To install dynaSpec from github you will need the R package devtools:
# From github devtools::install_github("maRce10/dynaSpec") #load package library(dynaSpec) Installation of external dependencies can be tricky on operating systems other than Linux.
[Read More]
Editing wave objects from extended selection tables
“Is there a simple way to remove noise from the clips in an extended table – I can do this by directly manipulating the attributes of the table but it seems a bit kludgy … so again, am I missing something simple?”
Manipulating clips from extended selection tables can be pretty straightforward. It can be done by using lapply() to go over each clip. Things should be fine as long as you don’t mess with any time related feature (i.
[Read More]
Automatic signal detection: a case study
Some recent additions to warbleR aim to simplify the automatic detection of signals. The current post details these additions with a study case detecting inquiry calls of Spix’s disc-winged bats (Thyroptera tricolor).
Inquiry calls were recorded while the bats were flying in a flight cage. Recordings were made on four channels, each one from a different mic. Mics were about 1m apart from each other. So the four channels from a recording event represent slightly different registers of the same calls.
[Read More]
Interactive maps from Xeno-Canto recording localities in xc_maps()
#load package library(warbleR)
#install leaflet install.packages("leaflet")
#create leaflet map xcmaps(X, leaflet.map = TRUE)
#create leaflet map xcmaps(X, leaflet.map = TRUE)
xcmaps(recs.2020, leaflet.map = TRUE)
xcmaps(bra.2020, leaflet.map = TRUE, leaflet.cluster = TRUE)
Signal detection with cross-correlation using warbleR
warbleR (v1.1.24) now includes functions to detect signals using cross-correlation similar to those in the package monitoR. There is already a blog post on cross-correlation detection using monitoR. In this post I show how to do that with warbleR and compare its performance against that from monitoR.
First install the latest developmental version of warbleR and load other packages (the code will install the packages if missing):
devtools::install_github("maRce10/warbleR") x <- c("warbleR", "monitoR", "microbenchmark", "ggplot2") out <- lapply(x, function(y) { if(!
[Read More]
Compare signals from selection tables to a set of templates using cross-correlation
I got the following question about cross-correlation:
“We would like to compare every call within a selection table to a template of each owl, and get peak correlation coefficients on each call separately”
One way to do this would be putting the unidentified and template signals together into a single selection table, and then running cross-correlation. However, this will also compare all unidentified signals against each other, which can be very inefficient.
[Read More]
Spectrograms on trees
This post describes the new warbleR function phylo_spectro. The function adds spectrograms of sounds annotated in a selection table (‘X argument) onto the tips of a tree (of class ‘phylo’). The ’tip.label’ column in ‘X’ is used to match spectrograms and tree tips. The function uses internally the plot.phylo function from the ape package to plot the tree and warbleR’s specreator function to create the spectrograms. Arguments for both of these functions can be provided for further customization.
[Read More]
Extended selection tables
This post shows how to create and use the new warbleR object class extended_selection_table.
These objects are created with the selec_table() function. The function takes data frames containing selection data (sound file name, selection, start, end …), checks whether the information is consistent (see checksels() function for details) and saves the ‘diagnostic’ metadata as an attribute. When the argument extended = TRUE the function generates an object of class extended_selection_table which also contains a list of wave objects corresponding to each of the selections in the data frame.
[Read More]
Simulating animal vocalizations
This post shows how to simulate animal vocalizations using the new warbleR function sim_songs. The function allows users to create song with several sub-units and harmonics, which are return as a wave object in the R environment. This can have several applications, from simulating song evolution to testing the efficacy of methods to measure acoustic structure for different signal types.
The function uses a brownian motion model of stochastic diffusion to simulate the changes in frequency (e.
[Read More]
Individual sound files for each selection
A friend of mine wants to “create individual sound files for each selection” in a selection table. This is a good opportunity to show how to create a function that works iteratively on signals in a selection table (like most warbleR functions).
It takes 3 main steps:
Create a (internal) function that does what we want on a single selection (i.e. a single row of the selection table)
Add and (X)lapply loop to run the function from step 1 iteratively on each row
[Read More]