1
0

Fix cutoff issue hopefully

This commit is contained in:
2026-07-27 17:22:58 -03:00
parent 28ae6a6115
commit 581da5febb
2 changed files with 14 additions and 0 deletions

View File

@@ -82,6 +82,14 @@ def generate(prompt_tokens, prompt_features_lens, prompt_features, prompt_rms, t
# Convert to waveform
pred_features = pred_features.permute(0, 2, 1) / 0.1
# FIX: Padding for the Vocoder
# We take the last frame and repeat it 15 times (approx 150ms buffer)
# This gives Vocos enough data to finish the previous sound without cutting it.
last_frame = pred_features[:, :, -1:]
padding_frames = last_frame.repeat(1, 1, 15)
pred_features = torch.cat([pred_features, padding_frames], dim=2)
wav = vocoder.decode(pred_features).squeeze(1).clamp(-1, 1)
# Volume matching