Dionyssos commited on
Commit
d89dc52
·
1 Parent(s): 8a9bf6c
Files changed (1) hide show
  1. tts.py +4 -4
tts.py CHANGED
@@ -210,7 +210,7 @@ class StyleTTS2(nn.Module):
210
  # print(x.shape, 'TTS TTS TTS TTS')
211
  if x.shape[2] < 100:
212
  x = torch.zeros(1, 1, 1000, device=self.device()) # silence if this sentence was empty
213
-
214
  # NORMALIS / Crop Scratch at end (The endingscratch sound is not solved even with nltk.sentence split & punctuation)
215
  x = x[..., 40:-4000]
216
  # x /= x.abs().max() + 1e-7 # preserve as torch
@@ -219,10 +219,10 @@ class StyleTTS2(nn.Module):
219
  # nohing to vocode
220
  x = torch.zeros(1, 1, 1000, device=self.device())
221
  total.append(x)
222
-
223
  # --
224
- # total = 1.94 * torch.cat(total, 2) # 1.94 * Perhaps exceeding -1,1 affects MIMI encode
225
- # total /= 1.02 * total.abs().max() + 1e-7
226
  # --
227
  return total
228
 
 
210
  # print(x.shape, 'TTS TTS TTS TTS')
211
  if x.shape[2] < 100:
212
  x = torch.zeros(1, 1, 1000, device=self.device()) # silence if this sentence was empty
213
+
214
  # NORMALIS / Crop Scratch at end (The endingscratch sound is not solved even with nltk.sentence split & punctuation)
215
  x = x[..., 40:-4000]
216
  # x /= x.abs().max() + 1e-7 # preserve as torch
 
219
  # nohing to vocode
220
  x = torch.zeros(1, 1, 1000, device=self.device())
221
  total.append(x)
222
+
223
  # --
224
+ total = torch.cat(total, 2)
225
+ total /= 1.02 * total.abs().max() + 1e-7
226
  # --
227
  return total
228