From 306274245b5aa2f5fbf1c5fb8e6e951582b31db7 Mon Sep 17 00:00:00 2001 From: James Betker Date: Fri, 10 Dec 2021 20:06:24 -0700 Subject: [PATCH] Also do dynamic range compression across mel --- codes/trainer/injectors/base_injectors.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codes/trainer/injectors/base_injectors.py b/codes/trainer/injectors/base_injectors.py index 051cd7ea..e9b4027e 100644 --- a/codes/trainer/injectors/base_injectors.py +++ b/codes/trainer/injectors/base_injectors.py @@ -617,6 +617,8 @@ class TorchMelSpectrogramInjector(Injector): assert len(inp.shape) == 2 self.mel_stft = self.mel_stft.to(inp.device) mel = self.mel_stft(inp) + # Perform dynamic range compression + mel = torch.log(torch.clamp(mel, min=1e-5)) return {self.output: mel}