pad_wav: Pad Wave Objects

View source: R/pad_wav.R

pad_wavR Documentation

Pad Wave Objects

Description

Pad Wave Objects

Usage

pad_wav(wav, duration = NULL)

Arguments

wav

list of Wave objects

duration

If NULL, the duration will simply round the Wave up to the next whole integer. If not, these are the duration to pad the Wave *to*. For example 12 means the output Wave will have a length of 12 seconds. Pass NA to those Waves that you want simple rounding.

Value

A list of Wave objects, same length as input wav

Examples

wavs <- list(
  tuneR::noise(duration = 1.85 * 44100),
  tuneR::noise()
)
out <- pad_wav(wavs)
dur <- sapply(out, function(x) length(x@left) / x@samp.rate)
duration <- c(2, 2)
out <- pad_wav(wavs, duration = duration)
dur <- sapply(out, function(x) length(x@left) / x@samp.rate)
stopifnot(all(dur == duration))
duration <- c(2, 2.5)
out <- pad_wav(wavs, duration = duration)
dur <- sapply(out, function(x) length(x@left) / x@samp.rate)
stopifnot(isTRUE(all.equal(dur, duration)))

seankross/ari documentation built on July 18, 2023, 4:35 p.m.