spectro_calls: Generate spectrograms from labels

View source: R/spectro_calls.R

spectro_callsR Documentation

Generate spectrograms from labels


Generate spectrograms from recording labels for classification purposes. The spectrogram parameters are user defined and should be selected depending on the type of sound event to classify.


spectro_calls(files_path, update_progress = NA,
db_path, spec_size = NA, window_length = NA,
frequency_resolution = 1, overlap = NA,
dynamic_range = NA, freq_range = NA, tx = 1, seed = 1002)



Character. Path for the folder containing sound recordings.


Progress bar only to be used inside shiny.


Character. Path for the database of recording labels created with the shinny app provided in the package.


Integer. Spectrogram size in ms.


Numeric. Moving window length in ms.


Integer. Spectrogram frequency resolution with higher values meaning better resolution. Specifically, for any integer X provided, 1/X the analysis bandwidth (as determined by the number of samples in the analysis window) will be used. Not implemented yet, always uses 1 as input value.


Percentage of overlap between moving windows. Accepts values between 0.5 and 0.75.


Threshold of minimum intensity values to show in the spectrogram. A value of 100 will typically be adequate for the majority of the recorders. If this is set to NULL, no threshold is applied.


Frequency range of the spectrogram. Vector with two values, referring to the minimum and maximum frequency to show in the spectrogram.


Time expanded. Only used in recorders specifically intended for bat recordings. Can take the values "auto" or any numeric value. If the recording is not time expanded tx must be set to 1 (the default). If it's time expanded the numeric value corresponding to the time expansion should be indicated or "auto" should be selected. If tx = "auto" the function assumes that sampling rates < 50kHz corresponds to tx = 10 and > 50kHz to tx = 1.


Integer. Define a custom seed for randomizing data.


A list with the following components:

  • data_x – an array with the spectrogram matrices

  • data_y – the labels for each matrix in one-hot-encoded format

  • parameters – the parameters used to create the matrices

  • labels_df – the labels with their respective numeric index


Bruno Silva

soundClass documentation built on May 30, 2022, 1:07 a.m.