Spectrograms

Spectrograms are a common visualization of sound data. Visualizing sound data can be useful when doing a presentation or for publication. Additionally, machine learning algorithms for classifying sound data generally use spectrograms as their starting point, instead of the sound data itself, as many advanced algorithnms for classifying images are readily available. The example uses the R packages warbleR (Araya-Salas & Smith-Vidaurre, 2017), seewave (Sueur, Aubin, Simonis, 2008) and tuneR (Ligges et al., 2018).

This example draws the spectrogram of the call of a tawny owl (Strix aluco).

Tawny owl (Strix aluco). Alvaro Ortiz Troncoso, XC494801. Accessible at www.xeno-canto.org/494801.

Here is the code

library(warbleR)

# read the file
url <- "https://www.xeno-canto.org/494801/download"
s1<-read_wave(url)

# draw the first 10 seconds of the sound file
spectro(
   s1, 
   palette=reverse.gray.colors.1,
   scale=FALSE,
   osc=TRUE,
   collevels=seq(-100,0,1),
   fastdisp=FALSE,
   tlim=c(0,10)
)

References

Araya-Salas, M. and Smith-Vidaurre, G. (2017), warbleR: an r package to streamline analysis of animal acoustic signals. Methods Ecol Evol. 8, 184-191

Ligges, U, Krey, S, Mersmann, O, and Schnackenberg, S (2018). tuneR: Analysis of Music and Speech. URL: https://CRAN.R-project.org/package=tuneR

Sueur J, Aubin T, Simonis C (2008). seewave: a free modular tool for sound analysis and synthesis. Bioacoustics, 18: 213-226

Leave a Reply

Your email address will not be published. Required fields are marked *