mirror of
https://github.com/wassname/TTS.git
synced 2026-09-09 11:16:00 +08:00
set silence trimming threshold in config
This commit is contained in:
+3
-1
@@ -24,6 +24,7 @@ class AudioProcessor(object):
|
||||
clip_norm=True,
|
||||
griffin_lim_iters=None,
|
||||
do_trim_silence=False,
|
||||
trim_db=60,
|
||||
sound_norm=False,
|
||||
**_):
|
||||
|
||||
@@ -46,6 +47,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.trim_db = trim_db
|
||||
self.sound_norm = sound_norm
|
||||
self.n_fft, self.hop_length, self.win_length = self._stft_parameters()
|
||||
assert min_level_db != 0.0, " [!] min_level_db is 0"
|
||||
@@ -217,7 +219,7 @@ class AudioProcessor(object):
|
||||
margin = int(self.sample_rate * 0.01)
|
||||
wav = wav[margin:-margin]
|
||||
return librosa.effects.trim(
|
||||
wav, top_db=40, frame_length=self.win_length, hop_length=self.hop_length)[0]
|
||||
wav, top_db=self.trim_db, frame_length=self.win_length, hop_length=self.hop_length)[0]
|
||||
|
||||
@staticmethod
|
||||
def mulaw_encode(wav, qc):
|
||||
|
||||
Reference in New Issue
Block a user