"src/git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "38321355d3476657126e0386b494fcdf517b20fb"
Commit eab211bb authored by comfyanonymous's avatar comfyanonymous
Browse files

Resample audio to 44100 when VAE encoding it.

parent 866f54da
......@@ -31,7 +31,13 @@ class VAEEncodeAudio:
CATEGORY = "_for_testing/audio"
def encode(self, vae, audio):
t = vae.encode(audio["waveform"].movedim(1, -1))
sample_rate = audio["sample_rate"]
if 44100 != sample_rate:
waveform = torchaudio.functional.resample(audio["waveform"], sample_rate, 44100)
else:
waveform = audio["waveform"]
t = vae.encode(waveform.movedim(1, -1))
return ({"samples":t}, )
class VAEDecodeAudio:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment