mirror of
https://github.com/wassname/TTS.git
synced 2026-09-11 12:00:24 +08:00
sound normalization while reading, adapting get_Speaker for multiple datasets
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user