in denoiser/augment.py [0:0]
def _reverb(self, source, initial, first_delay, rt60):
"""
Return the reverb for a single source.
"""
length = source.shape[-1]
reverb = th.zeros_like(source)
for _ in range(self.repeat):
frac = 1 # what fraction of the first echo amplitude is still here
echo = initial * source
while frac > 1e-3:
# First jitter noise for the delay
jitter = 1 + self.jitter * random.uniform(-1, 1)
delay = min(
1 + int(jitter * first_delay * self.sample_rate),
length)
# Delay the echo in time by padding with zero on the left
echo = F.pad(echo[:, :, :-delay], (delay, 0))
reverb += echo
# Second jitter noise for the attenuation
jitter = 1 + self.jitter * random.uniform(-1, 1)
# we want, with `d` the attenuation, d**(rt60 / first_ms) = 1e-3
# i.e. log10(d) = -3 * first_ms / rt60, so that
attenuation = 10**(-3 * jitter * first_delay / rt60)
echo *= attenuation
frac *= attenuation
return reverb