Learn R Programming

warbleR (version 1.1.28)

wav_2_flac: Convert .wav files to .flac

Description

wav_2_flac converts several .wav files to .flac compressed lossless format

Usage

wav_2_flac(files = NULL, path = NULL, overwrite = FALSE, 
pb = TRUE, parallel = 1)

Value

.wav files saved in the working directory with same name as original mp3 files.

Arguments

files

character vector with the names of files to be converted. If NULL all files in the working directory (or 'path' if supplied) are converted.

path

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

overwrite

Logical. Control whether a .flac sound file that is already in the working directory should be overwritten.

pb

Logical argument to control if progress bar is shown. Default is TRUE. It can also be set globally using the 'pb' option (see warbleR_options).

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). It can also be set globally using the 'parallel' option (see warbleR_options).

Author

Marcelo Araya-Salas (marcelo.araya@ucr.ac.cr)

Details

The function will convert all mp3 files in working directory or 'path' supplied to wav format. bioacoustics package must be installed when changing sampling rates (i.e. if 'samp.rate' is supplied). Note that sound files are normalized using normalize so they can be written by writeWave.

convert all .wav files in working directory to .flac compressed lossless format. It's just a silly wrapper over (wav2flac) to simplify converting several files at once.

Examples

Run this code
if (FALSE) {
# create some .wav files
data(list = c("Phae.long1", "Phae.long2", "Phae.long3", "Phae.long4"))
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"))

# Convert all files to .flac format
wav_2_flac(path = tempdir())

#check this folder!!
open_wd(tempdir())
}

Run the code above in your browser using DataLab