Learn R Programming

monitoR (version 1.2)

changeSampRate: Resample Wave objects

Description

Downsample or upsample Wave objects by specifying either a new sample rate or matching the sample rate of a different Wave object. Optional adjustable dithering.

Usage

changeSampRate(wchange, wkeep = NULL, sr.new = wkeep@samp.rate, dither = FALSE, 
               dith.noise = 32)

Value

An object of class Wave with a modified sample rate.

Arguments

wchange

Object of class Wave to resample.

wkeep

Object of class Wave to use to match sampling rate, or specify sampling rate with sr.new.

sr.new

Numerical sampling rate, if specified directly.

dither

Logical. TRUE adds gaussian dithering.

dith.noise

Adjustable dithering. If dither = TRUE, this value will be the stdev of the normally distributed noise.

Author

Sasha D. Hafner, Jon Katz

Details

Both downsampling and upsampling are done by spline-fitting a curve to the waveform and resampling the resulting waveform. Artifacts from resampling are nearly guaranteed. Artifacts can be masked with dithering at a cost: dithering raises the amplitude of background noise but not signal.

See Also

downsample

Examples

Run this code
data(survey)

survey <- changeSampRate(wchange = survey, sr.new = 24000)

Run the code above in your browser using DataLab