fix_wavs
fixes sound files in .wav format so they can be imported into R.
fix_wavs(checksels = NULL, files = NULL, samp.rate = NULL, bit.depth = NULL,
path = NULL, mono = FALSE)
A folder inside the working directory (or path provided) all 'converted_sound_files', containing sound files in a format that can be imported in R.
Data frame with results from check_sels
. Default is NULL
. If both 'checksels' and 'files' are NULL
then all files in 'path' are converted. Note that it only fixes/convert sound files in .wav format.
Character vector with the names of the .wav files to fix. Default is NULL
. If both 'checksels' and 'files' are NULL
then all files in 'path' are converted.
Numeric vector of length 1 with the sampling rate (in kHz) for output files. Default is NULL
.
(remain unchanged).
Numeric vector of length 1 with the dynamic interval (i.e. bit depth) for output files.
Default is NULL
(remain unchanged).
Character string containing the directory path where the sound files are located.
If NULL
(default) then the current working directory is used.
Logical indicating if stereo (2 channel) files should be converted to mono (1 channel). Default is FALSE
(remain unchanged).
Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)
This function aims to simplify the process of converting sound files that cannot be imported into R and/or homogenizing sound files. Problematic files can be determined using check_wavs
or check_sels
. The
check_sels
output can be directly input using the argument 'checksels'. Alternatively a vector of file
names to be "fixed" can be provided (argument 'files'). If neither of those 2 are provided the function will convert
all .wav sound files in the working directory to the specified sample rate/bit depth. Files are saved in a new directory
('converted_sound_files'). Internally the function calls SOX (SOX must be installed). If both 'checksels' and 'files' are NULL
then all files in 'path' are converted. Note that it only fixes/convert sound files in .wav format.
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.
if (FALSE) {
# Load example files and save to temporary working directory
#
# check this folder
tempdir()
}
Run the code above in your browser using DataLab