Signal detection with cross-correlation using monitoR
Posted on December 15, 2016
Here I show how to detect signals with cross-correlation using the very cool package monitoR. This package aims to facilitate acoustic template detection. The code here is similar but much less detailed than the quick start vignette of the monitoR package, so I encourage to look at the vignette if you want to learn more about it.
The package monitoR runs cross-correlation across sound files to search for the signals using previously defined templates. Thus, templates should be examples of the signals we want to detect. It can search for several templates in the same run. I show how the package works using the sound files and data examples that come with the package warbleR. These are recordings from long-billed hermits, each one singing a different song type.
First load the packages (the code will install the packages if missing)
We need to create the templates. We just have to select and example from each sound file and provide the start and end as well as the frequency range of the signal. We will load the long-billed hermit sound
and create the templates
Now that we have the templates we can search for those “acoustic patterns” in a sound file. As the function uses cross-correlation to determine the similarity to the templates we need to select a correlation method. In this case we use Pearson correlation. Lets do it first with the template from the Phae.long1.wav file
Now we can extract the detection peaks and generate a graphical output
We can do the same for each sound file
We can also run all templates on a single sound file. It requires putting together all templates in a single object