Learn R Programming

warbleR (version 1.1.17)

cut_sels: Cut selections into individual sound files

Description

cut_sels cuts selections from a selection table into individual sound files.

Usage

cut_sels(X, mar = 0.05, parallel = 1, path = NULL, dest.path = NULL, pb = TRUE,
labels = c("sound.files", "selec"), overwrite = FALSE, ...)

Arguments

X

object of class 'selection_table', 'extended_selection_table' or data frame containing columns for sound file name (sound.files), selection number (selec), and start and end time of signals (start and end). The ouptut of manualoc or autodetec can be used as the input data frame.

mar

Numeric vector of length 1. Specifies the margins adjacent to the start and end points of selections, dealineating spectrogram limits. Default is 0.05.

parallel

Numeric. Controls whether parallel computing is applied. It specifies the number of cores to be used. Default is 1 (i.e. no parallel computing).

path

Character string containing the directory path where the sound files are located. If NULL (default) then the current working directory is used.

dest.path

Character string containing the directory path where the cut sound files will be saved. If NULL (default) then the directory containing the sound files will be used instead.

pb

Logical argument to control progress bar. Default is TRUE.

labels

String vector. Provides the column names that will be used as labels to create sound file names. Note that they should provide unique names (otherwise sound files will be overwritten). Default is c("sound.files", "selec").

overwrite

Logical. If TRUE sound files with the same name will be overwritten. Default is FALSE.

...

Additional arguments to be passed to the internal writeWave function for customizing sound file output (e.g. normalization).

Value

Sound files of the signals listed in the input data frame.

Details

This function allow users to produce individual sound files from the selections listed in a selection table as in lbh_selec_table.

References

Araya-Salas, M., & Smith-Vidaurre, G. (2017). warbleR: An R package to streamline analysis of animal acoustic signals. Methods in Ecology and Evolution, 8(2), 184-191.

See Also

seltailor for tailoring selections blog post on cutting sound files

Examples

Run this code
# NOT RUN {
{ 
# save wav file examples
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4", "lbh_selec_table"))
writeWave(Phae.long1, file.path(tempdir(), "Phae.long1.wav"))
writeWave(Phae.long2, file.path(tempdir(), "Phae.long2.wav"))
writeWave(Phae.long3, file.path(tempdir(), "Phae.long3.wav"))
writeWave(Phae.long4, file.path(tempdir(), "Phae.long4.wav"))

# cut selections
cut_sels(lbh_selec_table, path = tempdir())
 
#check this folder!!
tempdir()
}

# }

Run the code above in your browser using DataLab