From ff2e2adc341f71a94e8a6471d51a9eaa8ca2d501 Mon Sep 17 00:00:00 2001 From: Dreaming Computers Date: Sun, 1 Feb 2026 15:05:32 +0700 Subject: [PATCH] feat: split suno nodes and update readme --- README.md | 59 +++++----- kie_api/suno_music.py | 12 +++ nodes.py | 101 +++++++++++++++--- ...no_Music.md => KIE_Suno_Music_Advanced.md} | 6 +- web/docs/KIE_Suno_Music_Basic.md | 26 +++++ 5 files changed, 158 insertions(+), 46 deletions(-) rename web/docs/{KIE_Suno_Music.md => KIE_Suno_Music_Advanced.md} (84%) create mode 100644 web/docs/KIE_Suno_Music_Basic.md diff --git a/README.md b/README.md index 60cf110..928346d 100644 --- a/README.md +++ b/README.md @@ -37,51 +37,48 @@ Do **NOT** share your API key or commit it to version control. This node pack currently includes the following nodes: -### Generation Nodes - +## Image Nodes - **Nano Banana Pro Image** - Image generation node using the Googles Nano Banana Pro model - - **Seedream Text-to-Image / Edit** - Text-to-image and image-editing node for Seedream models. - Supports prompt-based generation and edits. - - **Flux 2 Image-to-Image (Pro/Flex)** - Image-to-image node with a model dropdown for Pro or Flex. - Accepts 1–8 input images via ComfyUI batch. +## Video Nodes +- **Kling 2.6 Image-to-Video** + - Generates video from a single input image. + - Uses the Kling 2.6 image-to-video model. +- **Kling 2.5 I2V Pro** + - Generates video from a required first image and optional tail image. + - Uses the Kling 2.5 Turbo image-to-video Pro model. +- **Kling 2.6 Text-to-Video** + - Generates video directly from a text prompt. + - Supports aspect ratio, duration, and sound options as exposed by the API. +- **Kling 2.6 Motion-Control Image-to-Video** + - Image-to-video generation with additional motion control parameters. + - Designed for more directed camera and motion behavior. +- **Seedance V1 Pro (Fast) Image-to-Video** + Fast image-to-video generation optimized for quick iteration. +- **Seedance 1.5 Pro Image-to-Video, Text-to-Video** + Higher-quality image-to-video generation using the Seedance 1.5 Pro model. + +## LLM Nodes - **Gemini (LLM) [Experimental]** - Text generation node using Gemini 2.5/3 Pro/Flash chat completions. - Supports role selection, media inputs (images/video/audio), optional reasoning output, and Google Search toggle. -- **Suno Music (Generate)** - - Generates music and returns AUDIO output. - - Uses KIE Suno API `generate` + `record-info` polling. +## Audio Nodes +- **Suno Music (Basic)** + - Minimal inputs: title, style, prompt, model, instrument, tags, gender. + - Returns AUDIO output via KIE Suno API `generate` + `record-info` polling. +- **Suno Music (Advanced)** + - Adds style/creative weights to the Basic node. + - Returns AUDIO output via KIE Suno API `generate` + `record-info` polling. -- **Kling 2.6 Image-to-Video** - - Generates video from a single input image. - - Uses the Kling 2.6 image-to-video model. - -- **Kling 2.5 I2V Pro** - - Generates video from a required first image and optional tail image. - - Uses the Kling 2.5 Turbo image-to-video Pro model. - -- **Kling 2.6 Text-to-Video** - - Generates video directly from a text prompt. - - Supports aspect ratio, duration, and sound options as exposed by the API. - -- **Kling 2.6 Motion-Control Image-to-Video** - - Image-to-video generation with additional motion control parameters. - - Designed for more directed camera and motion behavior. - -- **Seedance V1 Pro (Fast) Image-to-Video** - Fast image-to-video generation optimized for quick iteration. - -- **Seedance 1.5 Pro Image-to-Video, Text-to-Video** - Higher-quality image-to-video generation using the Seedance 1.5 Pro model. - - -### Utility / Helper Nodes +## Utility / Helper Nodes - **Get Remaining Credits** - Return number of credits remaining diff --git a/kie_api/suno_music.py b/kie_api/suno_music.py index af3c724..eec13ab 100644 --- a/kie_api/suno_music.py +++ b/kie_api/suno_music.py @@ -264,6 +264,18 @@ def run_suno_generate( raise RuntimeError(f"Failed to download audio: {exc}") from exc audio_output = _audio_bytes_to_comfy_audio(audio_bytes, "audio.mp3") + try: + import torch + waveform = audio_output.get("waveform") + if not isinstance(waveform, torch.Tensor): + waveform = torch.as_tensor(waveform) + if waveform.ndim == 1: + waveform = waveform.unsqueeze(0) + if waveform.ndim == 2: + waveform = waveform.unsqueeze(0) + audio_output["waveform"] = waveform + except Exception as exc: + raise RuntimeError(f"Failed to normalize audio waveform for ComfyUI: {exc}") from exc if log: waveform = audio_output.get("waveform") shape = getattr(waveform, "shape", None) diff --git a/nodes.py b/nodes.py index 518ba37..fa793b6 100644 --- a/nodes.py +++ b/nodes.py @@ -723,11 +723,11 @@ Outputs: return (content, reasoning, raw_json) -class KIE_Suno_Music: +class KIE_Suno_Music_Basic: HELP = """ -KIE Suno Music (Generate) +KIE Suno Music (Basic) -Create a Suno music generation task via KIE API. Returns a taskId. +Create a Suno music generation task via KIE API. Returns an AUDIO output and record JSON. Inputs: - title: Track title (required in custom mode) @@ -736,14 +736,13 @@ Inputs: - custom_mode: Enable custom mode (required) - instrumental: Instrumental-only mode (required) - model: V4 / V4_5 / V4_5PLUS / V4_5ALL / V5 -- style: Required in custom mode -- title: Required in custom mode + +Optional: - negative_tags: Optional tags to avoid - vocal_gender: m or f (custom mode only) -- style_weight / weirdness_constraint / audio_weight: 0..1 - log: Console logging on/off - Outputs: +Outputs: - AUDIO: Generated audio - STRING: raw_json """ @@ -761,7 +760,82 @@ Inputs: }, "optional": { "negative_tags": ("STRING", {"default": ""}), - "vocal_gender": ("COMBO", {"options": ["m", "f"], "default": "m"}), + "vocal_gender": ("COMBO", {"options": ["male", "female"], "default": "male"}), + "log": ("BOOLEAN", {"default": True}), + }, + } + + RETURN_TYPES = ("AUDIO", "STRING") + RETURN_NAMES = ("audio", "raw_json") + FUNCTION = "generate" + CATEGORY = "kie/api" + + def generate( + self, + title: str, + style: str, + prompt: str, + custom_mode: bool, + instrumental: bool, + model: str, + negative_tags: str = "", + vocal_gender: str = "male", + log: bool = True, + ): + gender_value = "m" if vocal_gender == "male" else "f" + audio_output, raw_json = run_suno_generate( + prompt=prompt, + custom_mode=custom_mode, + instrumental=instrumental, + model=model, + style=style, + title=title, + negative_tags=negative_tags, + vocal_gender=gender_value, + log=log, + ) + return (audio_output, raw_json) + + +class KIE_Suno_Music_Advanced: + HELP = """ +KIE Suno Music (Advanced) + +Create a Suno music generation task via KIE API. Returns an AUDIO output and record JSON. + +Inputs: +- title: Track title (required in custom mode) +- style: Style text (required in custom mode) +- prompt: Text prompt (lyrics in custom mode when instrumental is false) +- custom_mode: Enable custom mode (required) +- instrumental: Instrumental-only mode (required) +- model: V4 / V4_5 / V4_5PLUS / V4_5ALL / V5 + +Optional: +- negative_tags: Optional tags to avoid +- vocal_gender: m or f (custom mode only) +- style_weight / weirdness_constraint / audio_weight: 0..1 +- log: Console logging on/off + +Outputs: +- AUDIO: Generated audio +- STRING: raw_json +""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "title": ("STRING", {"default": ""}), + "style": ("STRING", {"default": "", "multiline": True}), + "prompt": ("STRING", {"multiline": True}), + "custom_mode": ("BOOLEAN", {"default": True}), + "instrumental": ("BOOLEAN", {"default": True}), + "model": ("COMBO", {"options": SUNO_MODEL_OPTIONS, "default": "V4_5"}), + }, + "optional": { + "negative_tags": ("STRING", {"default": ""}), + "vocal_gender": ("COMBO", {"options": ["male", "female"], "default": "male"}), "style_weight": ("FLOAT", {"default": 0.65, "min": 0.0, "max": 1.0, "step": 0.01}), "weirdness_constraint": ("FLOAT", {"default": 0.65, "min": 0.0, "max": 1.0, "step": 0.01}), "audio_weight": ("FLOAT", {"default": 0.65, "min": 0.0, "max": 1.0, "step": 0.01}), @@ -783,12 +857,13 @@ Inputs: instrumental: bool, model: str, negative_tags: str = "", - vocal_gender: str = "m", + vocal_gender: str = "male", style_weight: float = 0.65, weirdness_constraint: float = 0.65, audio_weight: float = 0.65, log: bool = True, ): + gender_value = "m" if vocal_gender == "male" else "f" audio_output, raw_json = run_suno_generate( prompt=prompt, custom_mode=custom_mode, @@ -797,7 +872,7 @@ Inputs: style=style, title=title, negative_tags=negative_tags, - vocal_gender=vocal_gender, + vocal_gender=gender_value, style_weight=style_weight, weirdness_constraint=weirdness_constraint, audio_weight=audio_weight, @@ -993,7 +1068,8 @@ NODE_CLASS_MAPPINGS = { "KIE_Kling26Motion_I2V": KIE_Kling26Motion_I2V, "KIE_Flux2_I2I": KIE_Flux2_I2I, "KIE_Gemini3Pro_LLM": KIE_Gemini3Pro_LLM, - "KIE_Suno_Music": KIE_Suno_Music, + "KIE_Suno_Music_Basic": KIE_Suno_Music_Basic, + "KIE_Suno_Music_Advanced": KIE_Suno_Music_Advanced, "KIE_GridSlice": KIE_GridSlice, "KIEParsePromptGridJSON": KIEParsePromptGridJSON, } @@ -1010,7 +1086,8 @@ NODE_DISPLAY_NAME_MAPPINGS = { "KIE_Kling26Motion_I2V": "KIE Kling 2.6 Motion-Control (I2V)", "KIE_Flux2_I2I": "KIE Flux 2 (Image-to-Image)", "KIE_Gemini3Pro_LLM": "KIE Gemini (LLM) [Experimental]", - "KIE_Suno_Music": "KIE Suno Music (Generate)", + "KIE_Suno_Music_Basic": "KIE Suno Music (Basic)", + "KIE_Suno_Music_Advanced": "KIE Suno Music (Advanced)", "KIE_GridSlice": "KIE Grid Slice", "KIEParsePromptGridJSON": "KIE Parse Prompt Grid JSON (1..9)", } diff --git a/web/docs/KIE_Suno_Music.md b/web/docs/KIE_Suno_Music_Advanced.md similarity index 84% rename from web/docs/KIE_Suno_Music.md rename to web/docs/KIE_Suno_Music_Advanced.md index 2479859..6c732b1 100644 --- a/web/docs/KIE_Suno_Music.md +++ b/web/docs/KIE_Suno_Music_Advanced.md @@ -1,6 +1,6 @@ -# KIE Suno Music (Generate) +# KIE Suno Music (Advanced) -Create a Suno music generation task via KIE API. This node polls until completion and returns an AUDIO output. +Create a Suno music generation task via KIE API. This node exposes advanced weights and returns an AUDIO output. ## Inputs - **title** (STRING, required): Track title (required in custom mode). @@ -11,7 +11,7 @@ Create a Suno music generation task via KIE API. This node polls until completio - **model** (COMBO, required): `V4`, `V4_5`, `V4_5PLUS`, `V4_5ALL`, `V5` Optional: - **negative_tags** (STRING): Optional. -- **vocal_gender** (COMBO): `m` or `f` (custom mode only). +- **vocal_gender** (COMBO): `male` or `female` (custom mode only). - **style_weight** (FLOAT): 0..1 - **weirdness_constraint** (FLOAT): 0..1 - **audio_weight** (FLOAT): 0..1 diff --git a/web/docs/KIE_Suno_Music_Basic.md b/web/docs/KIE_Suno_Music_Basic.md new file mode 100644 index 0000000..a654a69 --- /dev/null +++ b/web/docs/KIE_Suno_Music_Basic.md @@ -0,0 +1,26 @@ +# KIE Suno Music (Basic) + +Create a Suno music generation task via KIE API. This node keeps inputs minimal and returns an AUDIO output. + +## Inputs +- **title** (STRING, required): Track title (required in custom mode). +- **style** (STRING, required): Style text (required in custom mode, multiline). +- **prompt** (STRING, required): Prompt text (lyrics in custom mode when instrumental is false). +- **custom_mode** (BOOLEAN, required): Enable custom mode. +- **instrumental** (BOOLEAN, required): Instrumental-only mode. +- **model** (COMBO, required): `V4`, `V4_5`, `V4_5PLUS`, `V4_5ALL`, `V5` + +Optional: +- **negative_tags** (STRING): Optional. +- **vocal_gender** (COMBO): `male` or `female` (custom mode only). +- **log** (BOOLEAN): Enable console logging. + +## Outputs +- **audio** (AUDIO): Generated audio. +- **raw_json** (STRING): Full API response JSON. + +## Notes +- Non-custom mode expects **prompt only** (500 chars max); other fields should be empty. +- Custom mode requirements: + - Instrumental: `style` + `title` + - Non-instrumental: `style` + `title` + `prompt`