diff --git a/comfy_extras/nodes_audio.py b/comfy_extras/nodes_audio.py index e5cc4dff..3cb918e0 100644 --- a/comfy_extras/nodes_audio.py +++ b/comfy_extras/nodes_audio.py @@ -8,6 +8,7 @@ import json import struct import random import hashlib +import node_helpers from comfy.cli_args import args class EmptyLatentAudio: @@ -29,6 +30,27 @@ class EmptyLatentAudio: latent = torch.zeros([batch_size, 64, length], device=self.device) return ({"samples":latent, "type": "audio"}, ) +class ConditioningStableAudio: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "negative": ("CONDITIONING", ), + "seconds_start": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1000.0, "step": 0.1}), + "seconds_total": ("FLOAT", {"default": 47.0, "min": 0.0, "max": 1000.0, "step": 0.1}), + }} + + RETURN_TYPES = ("CONDITIONING","CONDITIONING") + RETURN_NAMES = ("positive", "negative") + + FUNCTION = "append" + + CATEGORY = "conditioning" + + def append(self, positive, negative, seconds_start, seconds_total): + positive = node_helpers.conditioning_set_values(positive, {"seconds_start": seconds_start, "seconds_total": seconds_total}) + negative = node_helpers.conditioning_set_values(negative, {"seconds_start": seconds_start, "seconds_total": seconds_total}) + return (positive, negative) + class VAEEncodeAudio: @classmethod def INPUT_TYPES(s): @@ -225,4 +247,5 @@ NODE_CLASS_MAPPINGS = { "SaveAudio": SaveAudio, "LoadAudio": LoadAudio, "PreviewAudio": PreviewAudio, + "ConditioningStableAudio": ConditioningStableAudio, }