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 |
-
|
| 225 |
-
|
| 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 |
|