Resample numeric data to a different rate.
Arguments
- x
A
numericvectorthat needs to be resampled.- source.rate
The rate at which
xwas sampled in Hz (or another unit, as long as it is in the same unit astarget.rate).- target.rate
The desired target sampling rate in Hz (or another unit, as long as it is in the same unit as
source.rate).- ...
Arguments passed on to
stats::approx. To simulate the Commodore Amiga hardware, it's best to use 'method = "constant"for resampling 8 bit samples.
Value
Returns a resampled numeric vector of length
round(length(x) * target.rate / source.rate) based on x.
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.