Merge commit 'bf8f76505fdd25ea99770f262eb9371509bf226d' as 'vendor/dumas_h3_continuum'

This commit is contained in:
2026-10-20 13:43:38 +00:00
481 changed files with 131517 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
"""Use Core audio DSP; retain the existing adapter for older Core versions."""
from __future__ import annotations
import importlib
def resample_audio(waveform, source_rate: int, target_rate: int):
if source_rate == target_rate:
return waveform
try:
core_audio = importlib.import_module("comfy.audio")
except ModuleNotFoundError as exc:
if exc.name not in {"comfy", "comfy.audio"}:
raise
core_audio = None
core_resample = getattr(core_audio, "resample", None)
if core_resample is not None:
# Errors from an available Core API are real errors, not API absence.
return core_resample(waveform, source_rate, target_rate)
try:
torchaudio = importlib.import_module("torchaudio")
except ModuleNotFoundError as exc:
if exc.name != "torchaudio":
raise
raise RuntimeError(
"Audio resampling requires comfy.audio.resample or legacy torchaudio"
) from exc
return torchaudio.functional.resample(waveform, source_rate, target_rate)