data (sound)
## downsample and then upsample the sound back to its original sampling frequency
downsamped = resample (sound, 11025)
upsamped = resample (downsamped, 22050)
## compare the beginning of the waveforms for all three sounds
par (mfrow = c(3,1), mar = c(4,4,1,1))
plot (sound$sound[1:2000], type = 'l')
plot (upsamped$sound[1:2000], type = 'l', col = 2)
plot (downsamped$sound[1:1000], type = 'l', col = 4)
## the original sound, and the sound which was downsampled
## then upsampled are very highly correlated
cor (sound$sound, upsamped$sound)
Run the code above in your browser using DataLab