Learn R Programming

warbleR (version 1.1.8)

fixwavs: Fix .wav files to allow importing them into R

Description

fixwavs fixes sound files in .wav format so they can be imported into R.

Usage

fixwavs(checksels = NULL, files = NULL, samp.rate = NULL, bit.rate = NULL,
 path = NULL, ...)

Arguments

checksels

Data frame with results from checksels.

files

Character vector with the names of the wav files to fix. Default is NULL. Default is NULL.

samp.rate

Numeric vector of length 1 with the sampling rate (in khz) for output files. Default is NULL.

bit.rate

Numeric vector of length 1 with the dynamic interval (i.e. bit rate) for output files. Default is NULL.

path

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

...

Additional arguments to be passed to sox.

Value

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.

Details

This function aims to simplify the process of converting sound files that cannot be imported into R to a format that can actually be imported. Problematic files can be determined using checksels. The checksels output can be directly input using the argument 'checksels'. Alternatively a vector of file names to be "fixed" can be provided (argument 'files'). Internally the function calls 'sox' through the sox function. 'sox' must be installed to be able to run this function.

Examples

Run this code
# NOT RUN {
# Set temporary working directory
setwd(tempdir())

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") 

fixwavs(files = selec.table$sound.files)

#check this folder
getwd()
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab