Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions comfy_extras/nodes_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def __init__(self):
@classmethod
def INPUT_TYPES(s):
return {"required": { "audio": ("AUDIO", ),
"filename_prefix": ("STRING", {"default": "audio/ComfyUI"})},
"filename_prefix": ("STRING", {"default": "audio/ComfyUI"}),
"bit_depth": ([16, 24], )},
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
}

Expand All @@ -164,7 +165,7 @@ def INPUT_TYPES(s):

CATEGORY = "audio"

def save_audio(self, audio, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=None):
def save_audio(self, audio, filename_prefix="ComfyUI", bit_depth=16, prompt=None, extra_pnginfo=None):
filename_prefix += self.prefix_append
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir)
results: list[FileLocator] = []
Expand All @@ -182,7 +183,7 @@ def save_audio(self, audio, filename_prefix="ComfyUI", prompt=None, extra_pnginf
file = f"{filename_with_batch_num}_{counter:05}_.flac"

buff = io.BytesIO()
torchaudio.save(buff, waveform, audio["sample_rate"], format="FLAC")
torchaudio.save(buff, waveform, audio["sample_rate"], format="FLAC", bits_per_sample=bit_depth)

buff = insert_or_replace_vorbis_comment(buff, metadata)

Expand Down