sound normalization while reading, adapting get_Speaker for multiple datasets

This commit is contained in:
Eren Golge
2019-10-04 18:20:30 +02:00
parent 8dec2a9e95
commit 0849e3c42f
3 changed files with 11 additions and 8 deletions
+4
View File
@@ -24,6 +24,7 @@ class AudioProcessor(object):
clip_norm=True,
griffin_lim_iters=None,
do_trim_silence=False,
sound_norm=False,
**_):
print(" > Setting up Audio Processor...")
@@ -45,6 +46,7 @@ class AudioProcessor(object):
self.max_norm = 1.0 if max_norm is None else float(max_norm)
self.clip_norm = clip_norm
self.do_trim_silence = do_trim_silence
self.sound_norm = sound_norm
self.n_fft, self.hop_length, self.win_length = self._stft_parameters()
members = vars(self)
for key, value in members.items():
@@ -243,6 +245,8 @@ class AudioProcessor(object):
except ValueError:
print(f' [!] File cannot be trimmed for silence - {filename}')
assert self.sample_rate == sr, "%s vs %s"%(self.sample_rate, sr)
if self.sound_norm:
x = x / x.max() * 0.9
return x
@staticmethod