mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-14 19:17:32 +08:00
Merge c38d415765 into fb51a988b6
This commit is contained in:
commit
23b4f59e60
@ -235,6 +235,54 @@ class SaveAudioOpus(IO.ComfyNode):
|
|||||||
save_opus = execute # TODO: remove
|
save_opus = execute # TODO: remove
|
||||||
|
|
||||||
|
|
||||||
|
class SaveAudioAdvanced(IO.ComfyNode):
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return IO.Schema(
|
||||||
|
node_id="SaveAudioAdvanced",
|
||||||
|
search_aliases=["save audio", "export audio", "output audio", "write audio", "flac", "mp3", "opus"],
|
||||||
|
display_name="Save Audio (Advanced)",
|
||||||
|
description="Saves the input audio to your ComfyUI output directory.",
|
||||||
|
category="audio",
|
||||||
|
inputs=[
|
||||||
|
IO.Audio.Input("audio", tooltip="The audio to save."),
|
||||||
|
IO.String.Input(
|
||||||
|
"filename_prefix",
|
||||||
|
default="audio/ComfyUI",
|
||||||
|
tooltip=(
|
||||||
|
"The prefix for the file to save. May include formatting tokens "
|
||||||
|
"such as %date:yyyy-MM-dd%."
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IO.DynamicCombo.Input(
|
||||||
|
"format",
|
||||||
|
options=[
|
||||||
|
IO.DynamicCombo.Option("flac", []),
|
||||||
|
IO.DynamicCombo.Option("mp3", [
|
||||||
|
IO.Combo.Input("quality", options=["V0", "128k", "320k"], default="V0"),
|
||||||
|
]),
|
||||||
|
IO.DynamicCombo.Option("opus", [
|
||||||
|
IO.Combo.Input("quality", options=["64k", "96k", "128k", "192k", "320k"], default="128k"),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
tooltip="The file format in which to save the audio.",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
|
||||||
|
is_output_node=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def execute(cls, audio, filename_prefix: str, format: dict) -> IO.NodeOutput:
|
||||||
|
file_format = format.get("format", None)
|
||||||
|
quality = format.get("quality", None)
|
||||||
|
if quality:
|
||||||
|
ui=UI.AudioSaveHelper.get_save_audio_ui(audio, filename_prefix=filename_prefix, cls=cls, format=file_format, quality=quality)
|
||||||
|
else:
|
||||||
|
ui=UI.AudioSaveHelper.get_save_audio_ui(audio, filename_prefix=filename_prefix, cls=cls, format=file_format)
|
||||||
|
return IO.NodeOutput(ui=ui)
|
||||||
|
|
||||||
|
|
||||||
class PreviewAudio(IO.ComfyNode):
|
class PreviewAudio(IO.ComfyNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def define_schema(cls):
|
def define_schema(cls):
|
||||||
@ -777,6 +825,7 @@ class AudioExtension(ComfyExtension):
|
|||||||
SaveAudio,
|
SaveAudio,
|
||||||
SaveAudioMP3,
|
SaveAudioMP3,
|
||||||
SaveAudioOpus,
|
SaveAudioOpus,
|
||||||
|
SaveAudioAdvanced,
|
||||||
LoadAudio,
|
LoadAudio,
|
||||||
PreviewAudio,
|
PreviewAudio,
|
||||||
ConditioningStableAudio,
|
ConditioningStableAudio,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user