applyDelay | R Documentation |
Apply a delay to a sound sample. See https://en.wikipedia.org/wiki/Comb_filter
applyDelay(sample, type = "feedforward", delayTime = 0.6, echoes = c(0.8))
sample |
soundSample object, input sample |
type |
Character string, the delay type: feedforward or feedback |
delayTime |
Numeric >0, delay time in s. |
echoes |
Numeric vector >0. The size of the vector gives the number of echoes, the values the level of each echo (generally decreases to 0). |
The sound sample with a delay effect
# example code
notes=c('E3','G3','A3','B3','D4','E4','G4')
synth=getSynth(notes)
raw=as.soundSample(play.instrument(synth,notes=notes[c(1,2,3,2,3,4,3,4,5,4,5,6,5,6,7)]))
plot(raw)
## Not run:
# All calls to function 'listen' are wrapped in \dontrun{} since
# they rely on an external audio player to listen to the audio samples.
# See ?tuneR::setWavPlayer for setting a default player.
listen(raw)
## End(Not run)
# Single echo by default
cooked=applyDelay(raw)
plot(cooked)
## Not run: listen(cooked)
# Multiple echoes
cooked=applyDelay(raw,echoes=1/(1:10))
plot(cooked)
## Not run: listen(cooked)
# Feedback-type delay
cooked=applyDelay(raw,echoes=1/(1:10),type='feedback')
plot(cooked)
## Not run: listen(cooked)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.