Apply transformations for modelling ready audio files.

tidy_audio_dir(
  audio_files,
  dest_dir = tempdir(),
  sample_rate = 16000,
  bits = 16,
  parallel = 1
)

Arguments

audio_files

character vector with the full path for the mp3 files.

dest_dir

optional atomic character indicating the path where to store the files. Default is a tempdir(). Set NULL if you want the dest dir be the same as origin (warning: it will overwrite the original wave files!)

sample_rate

integer. Sample rate.

bits

integer.

Value

a character vector of the same size of audio_files with the file names of the transformed wavs.

Details

The transformations are:

- mp3 to wav - normalization - stereo to mono

Examples

mp3_dir <- system.file("mp3_sample", package = "mestrado") mp3_files <- list.files(mp3_dir, full.names = TRUE) wav_files <- tidy_audio(mp3_files)
#> Error in (function (classes, fdef, mtable) { methods <- .findInheritedMethods(classes, fdef, mtable) if (length(methods) == 1L) return(methods[[1L]]) else if (length(methods) == 0L) { cnames <- paste0("\"", vapply(classes, as.character, ""), "\"", collapse = ", ") stop(gettextf("unable to find an inherited method for function %s for signature %s", sQuote(fdef@generic), sQuote(cnames)), domain = NA) } else stop("Internal error in finding inherited methods; didn't return a unique method", domain = NA)})(list("character"), new("standardGeneric", .Data = function (object, unit = c("1", "8", "16", "24", "32", "64", "0"), center = TRUE, level = 1, rescale = TRUE, pcm = object@pcm) standardGeneric("normalize"), generic = structure("normalize", package = "tuneR"), package = "tuneR", group = list(), valueClass = character(0), signature = c("object", "unit", "center", "level", "rescale", "pcm"), default = NULL, skeleton = (function (object, unit = c("1", "8", "16", "24", "32", "64", "0"), center = TRUE, level = 1, rescale = TRUE, pcm = object@pcm) stop("invalid call in method dispatch to 'normalize' (no default method)", domain = NA))(object, unit, center, level, rescale, pcm)), <environment>): unable to find an inherited method for function ‘normalize’ for signature ‘"character"’