Replace torchaudio.save with soundfile.write; add EPUB loader node

- nodes/generator.py: swap torchaudio.save for soundfile.write to avoid
  torchcodec/FFmpeg dependency crash in environments without FFmpeg shared libs
- nodes/epub_loader.py: new OmniVoiceEpubLoader node for loading EPUB chapters
- tests/test_epub_loader.py: 8 tests for the EPUB loader
- install.py: add beautifulsoup4 to runtime deps
- __init__.py, nodes/__init__.py: register OmniVoiceEpubLoader

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-05 17:24:18 +02:00
parent 5366f6992e
commit 5dfaa0b300
8 changed files with 254 additions and 6 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
import tempfile
import os
import torch
import torchaudio
import soundfile as sf
class OmniVoiceGenerate:
@@ -109,7 +109,9 @@ class OmniVoiceGenerate:
tmp.close()
try:
ref_waveform = ref_audio["waveform"].squeeze(0).cpu() # (channels, samples)
torchaudio.save(tmp_path, ref_waveform, int(ref_audio["sample_rate"]))
audio_np = ref_waveform.numpy()
# soundfile expects (samples,) for mono or (samples, channels) for multi-channel
sf.write(tmp_path, audio_np[0] if audio_np.shape[0] == 1 else audio_np.T, int(ref_audio["sample_rate"]))
kwargs["ref_audio"] = tmp_path
if ref_text:
kwargs["ref_text"] = ref_text