Adds reverberation and/or echo to a sound. Algorithm for reverb: adds time-shifted copies of the signal weighted by a decay function, which is analogous to convoluting the input with a parametric model of some hypothetical impulse response function. In simple terms: we specify how much and when the sound rebounds back (as from a wall) and add these time-shifted copies to the original, optionally with some spectral filtering.
reverb(
x,
samplingRate = NULL,
echoDelay = 200,
echoLevel = -20,
reverbDelay = 70,
reverbSpread = 130,
reverbLevel = -25,
reverbDensity = 50,
reverbType = "gaussian",
filter = list(),
dynamicRange = 80,
output = c("audio", "detailed")[1],
play = FALSE,
reportEvery = NULL,
cores = 1,
saveAudio = NULL
)
path to a folder, one or more wav or mp3 files c('file1.wav', 'file2.mp3'), Wave object, numeric vector, or a list of Wave objects or numeric vectors
sampling rate of x
(only needed if x
is a
numeric vector)
the delay at which the echo appears, ms
the rate at which the echo weakens at each repetition, dB
the time of maximum reverb density, ms
standard deviation of reverb spread around time
reverbDelay
, ms
the maximum amplitude of reverb, dB below input
the number of echos or "voices" added
so far only "gaussian" has been implemented
(optional) a spectral filter to apply to the created reverb and
echo (see addFormants
for acceptable formats)
the precision with which the reverb and echo are calculated, dB
"audio" = returns just the processed audio, "detailed" = returns a list with reverb window, the added reverb/echo, etc.
if TRUE, plays the processed audio
when processing multiple inputs, report estimated time left every ... iterations (NULL = default, NA = don't report)
number of cores for parallel processing
full (!) path to folder for saving the processed audio; NULL = don't save, '' = same as input folder (NB: overwrites the originals!)
s = soundgen()
s_rev = reverb(s, 16000)
# playme(s_rev)
if (FALSE) {
# double echo, no reverb
s1 = reverb(s, samplingRate = 16000, reverbLevel = NULL,
echoDelay = c(250, 800), echoLevel = c(-15, -25))
# playme(s1)
# spectrogram(s1, 16000, osc = TRUE, ylim = c(0, 4))
# only reverb (indoors)
s2 = reverb(s, samplingRate = 16000, echoDelay = NULL,
reverbDelay = 70, reverbSpread = 130,
reverbLevel = -20, reverbDensity = 20)
# playme(s2)
# spectrogram(s2, 16000, osc = TRUE, ylim = c(0, 4))
# reverb (caves)
s3 = reverb(s, samplingRate = 16000, echoDelay = NULL,
reverbDelay = 600, reverbSpread = 1500,
reverbLevel = -10, reverbDensity = 100)
# playme(s3)
# spectrogram(s3, 16000, osc = TRUE, ylim = c(0, 4))
# both echo and reverb with high frequencies emphasized
s4 = reverb(s, samplingRate = 16000,
echoDelay = 250, echoLevel = -20,
reverbDelay = 70, reverbSpread = 120,
reverbLevel = -25, reverbDensity = 50,
filter = list(formants = NULL, lipRad = 3))
# playme(s4)
# spectrogram(s4, 16000, osc = TRUE, ylim = c(0, 4))
# add reverb to a recording
s5 = reverb('~/Downloads/temp260/ut_fear_57-m-tone.wav',
echoDelay = 850, echoLevel = -40)
# playme(s5, 44100)
# add reverb to all files in a folder, save the result
reverb('~/Downloads/temp2', saveAudio = '~/Downloads/temp2/rvb')
}
Run the code above in your browser using DataLab