Learn R Programming

warbleR (version 1.1.12)

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

'selection.table' object or data frame with results 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 current working directory is used.

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 selec.table.

See Also

seltailor for tailoring selections https://marce10.github.io/2017/06/06/Individual_sound_files_for_each_selection.html

Other selection manipulation, sound file manipulation: consolidate

Examples

Run this code
# NOT RUN {
{ 
# First set empty folder
# setwd(tempdir())

# save wav file examples
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4", "selec.table"))
writeWave(Phae.long1,"Phae.long1.wav")
writeWave(Phae.long2,"Phae.long2.wav")
writeWave(Phae.long3,"Phae.long3.wav")
writeWave(Phae.long4,"Phae.long4.wav")

# make spectrograms

cut_sels(selec.table)
 
cut_sels(selec.table, overwrite = TRUE, labels = c("sound.files", "selec", "sel.comment"))
 
 #check this folder!!
getwd()
}

# }

Run the code above in your browser using DataLab