From a2c542a2bc93b85d205577133429feca0e57f2e3 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 5 Apr 2026 10:34:53 +0200 Subject: [PATCH] fix: move output waveform to CPU and cast sample_rate to int --- nodes/generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes/generator.py b/nodes/generator.py index 5239f90..f076b0f 100644 --- a/nodes/generator.py +++ b/nodes/generator.py @@ -44,7 +44,7 @@ class OmniVoiceGenerate: tmp.close() try: waveform = ref_audio["waveform"].squeeze(0).cpu() # (channels, samples) - torchaudio.save(tmp_path, waveform, ref_audio["sample_rate"]) + torchaudio.save(tmp_path, waveform, int(ref_audio["sample_rate"])) kwargs["ref_audio"] = tmp_path if ref_text: kwargs["ref_text"] = ref_text @@ -60,7 +60,7 @@ class OmniVoiceGenerate: audio_tensors = model.generate(**kwargs) # Concatenate chunks: each tensor is (1, T) → concat along T → (1, T_total) - combined = torch.cat(audio_tensors, dim=1) # (1, T_total) + combined = torch.cat(audio_tensors, dim=1).cpu() # (1, T_total) on CPU # ComfyUI AUDIO format: (batch, channels, samples) waveform = combined.unsqueeze(0) # (1, 1, T_total)