Add ConditioningStableAudio.

This lets you control the seconds_start and seconds_total parameters for
the Stable Audio model.
This commit is contained in:
comfyanonymous 2024-12-18 03:01:12 -05:00
parent 37e5390f5f
commit 79badea452

View File

@ -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,
}