changeSampRate: Resample Wave objects

View source: R/changeSampRate.R

changeSampRateR Documentation

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)

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.

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.

Value

An object of class Wave with a modified sample rate.

Author(s)

Sasha D. Hafner, Jon Katz

See Also

downsample

Examples

data(survey)

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

jonkatz2/monitoR documentation built on March 27, 2024, 4:39 p.m.