Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
eab211bb
"git@developer.sourcefind.cn:chenpangpang/diffusers.git" did not exist on "0e5f2daee7b8736cf02c5e8789982432cf3e201c"
Commit
eab211bb
authored
Jun 24, 2024
by
comfyanonymous
Browse files
Resample audio to 44100 when VAE encoding it.
parent
866f54da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
comfy_extras/nodes_audio.py
comfy_extras/nodes_audio.py
+7
-1
No files found.
comfy_extras/nodes_audio.py
View file @
eab211bb
...
@@ -31,7 +31,13 @@ class VAEEncodeAudio:
...
@@ -31,7 +31,13 @@ class VAEEncodeAudio:
CATEGORY
=
"_for_testing/audio"
CATEGORY
=
"_for_testing/audio"
def
encode
(
self
,
vae
,
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
},
)
return
({
"samples"
:
t
},
)
class
VAEDecodeAudio
:
class
VAEDecodeAudio
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment