Spaces:
Runtime error
Runtime error
Implement quick trimming (reduce artefacts)
Browse files
app.py
CHANGED
|
@@ -199,9 +199,17 @@ def generate(audio_path, ins, speed, alpha, beta, embedding, steps=100):
|
|
| 199 |
alpha=alpha, beta=beta, is_phonemes=True,
|
| 200 |
embedding_scale=embedding, prev_s=s_prev, ref_s=ref_s,
|
| 201 |
speed=speed, t=0.7)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
audio = np.concatenate((audio, synthaud))
|
| 203 |
scaled = np.int16(audio / np.max(np.abs(audio)) * 32767)
|
| 204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
return 24000, scaled
|
| 206 |
|
| 207 |
|
|
|
|
| 199 |
alpha=alpha, beta=beta, is_phonemes=True,
|
| 200 |
embedding_scale=embedding, prev_s=s_prev, ref_s=ref_s,
|
| 201 |
speed=speed, t=0.7)
|
| 202 |
+
|
| 203 |
+
n_trim = int(len(synthaud) * 0.008) # 960 samples
|
| 204 |
+
synthaud[:n_trim] = 0
|
| 205 |
+
synthaud[-n_trim:] = 0
|
| 206 |
audio = np.concatenate((audio, synthaud))
|
| 207 |
scaled = np.int16(audio / np.max(np.abs(audio)) * 32767)
|
| 208 |
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
|
| 213 |
return 24000, scaled
|
| 214 |
|
| 215 |
|