resample {ProTrackR} | R Documentation |
Resample data
Description
Resample numeric
data to a different rate.
Usage
resample(x, source.rate, target.rate, ...)
Arguments
x |
A |
source.rate |
The rate at which |
target.rate |
The desired target sampling rate in Hz (or
another unit, as long as it is in the same unit as |
... |
Arguments passed on to |
Details
This function resamples numeric
data (i.e., audio data) from a
source sample rate to a target sample rate. At the core it uses
the stats::approx
function.
Value
Returns a resampled numeric
vector
of length
round(length(x) * target.rate / source.rate)
based on x
.
Author(s)
Pepijn de Vries
Examples
some.data <- 1:100
## assume that the current (sample) rate
## of 'some.data' is 100, and we want to
## resample this data to a rate of 200:
resamp.data <- resample(some.data, 100, 200, method = "constant")
[Package ProTrackR version 0.4.3 Index]