Spark Online Training by Edureka

resample: Resample a Sound

Description Usage Arguments Value Author(s) Examples

Description

Resample using sinc interpolation.

Usage

1
resample (sound, newfs, oldfs, precision = 50, filterorder = 200, synthfilter = FALSE)

Arguments

sound

Either a numeric vector representing a sequence of samples taken from a sound wave or a sound object created with the loadsound() or makesound() functions.

newfs

The new desired sampling frequency.

oldfs

The original sampling frequency. If a 'sound' object is provided, this does not need to be specified.

precision

The number of samples before and after the current point to be used for interpolation.

filterorder

The number of taps to be used for the low-pass FIR filters used, where appropriate.

synthfilter

If TRUE, synthfilter() is used for filtering.

Value

The resampled vector is returned. If a 'sound' object is passed, the resampled sound is returned as an object.

Author(s)

Santiago Barreda <sbarreda@ucdavis.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data (sound)
## downsample and then upsample the sound back to 
## its original sampling frequency
#downsamped = resample (sound, 11025)
#upsamped = resample (downsamped, 22050)

# compare a part of the waveforms for all three sounds
#par (mfrow = c(3,1), mar = c(4,4,1,1))
#plot (sound$sound[1:14000], type = 'l')
#plot (upsamped$sound[1:14000], type = 'l', col = 2)
#plot (downsamped$sound[1:7000], type = 'l', col = 4)


Search within the phonTools package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.