Pad Wave Objects

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