From 7ecb2ec1699dc988f93188c04733eeb8a41e8196 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 28 Jun 2024 02:55:36 -0400 Subject: [PATCH] Audio second setting in EmptyLatentAudio. --- comfy_extras/nodes_audio.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/comfy_extras/nodes_audio.py b/comfy_extras/nodes_audio.py index 34bcfa96..6481ed3b 100644 --- a/comfy_extras/nodes_audio.py +++ b/comfy_extras/nodes_audio.py @@ -14,15 +14,16 @@ class EmptyLatentAudio: @classmethod def INPUT_TYPES(s): - return {"required": {}} + return {"required": {"seconds": ("FLOAT", {"default": 47.6, "min": 1.0, "max": 1000.0, "step": 0.1})}} RETURN_TYPES = ("LATENT",) FUNCTION = "generate" CATEGORY = "_for_testing/audio" - def generate(self): + def generate(self, seconds): batch_size = 1 - latent = torch.zeros([batch_size, 64, 1024], device=self.device) + length = round((seconds * 44100 / 2048) / 2) * 2 + latent = torch.zeros([batch_size, 64, length], device=self.device) return ({"samples":latent, "type": "audio"}, ) class VAEEncodeAudio: