From 964d0d68c5fb2dfcb0261f7ebdb7bcdbb14c63e7 Mon Sep 17 00:00:00 2001 From: Sayo Date: Sun, 1 Mar 2026 17:35:05 +0900 Subject: [PATCH 1/2] fix: wav parse --- nodes.py | 58 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/nodes.py b/nodes.py index 4b5aa81..90b3351 100644 --- a/nodes.py +++ b/nodes.py @@ -95,28 +95,54 @@ def _encode_audio_b64(audio) -> str: return _tensor_to_wav_b64(waveform, audio["sample_rate"]) +def _parse_wav_bytes(audio_bytes: bytes): + """Parse WAV bytes manually to support PCM (fmt=1) and float32 (fmt=3).""" + if audio_bytes[:4] != b"RIFF" or audio_bytes[8:12] != b"WAVE": + raise RuntimeError("Not a valid WAV file") + pos = 12 + fmt_tag = n_channels = sample_rate = sampwidth = 0 + data_offset = data_size = 0 + while pos < len(audio_bytes) - 8: + chunk_id = audio_bytes[pos:pos+4] + chunk_size = struct.unpack_from(" Date: Sun, 1 Mar 2026 17:37:41 +0900 Subject: [PATCH 2/2] feat: change generation info --- nodes.py | 44 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/nodes.py b/nodes.py index 90b3351..852bf0d 100644 --- a/nodes.py +++ b/nodes.py @@ -269,7 +269,7 @@ class AceStepAudioCodes: """Editable audio codes passthrough. Paste codes manually, or receive from Text2Music Server generation output.""" - CATEGORY = "ACE-Step" + CATEGORY = "api node/audio/ACE-Step" FUNCTION = "process" RETURN_TYPES = ("STRING",) RETURN_NAMES = ("audio_codes",) @@ -307,7 +307,7 @@ class AceStepAudioCodes: class AceStepText2MusicGenParams: """Generation parameters for text2music / cover / remix / repaint.""" - CATEGORY = "ACE-Step" + CATEGORY = "api node/audio/ACE-Step" FUNCTION = "build" RETURN_TYPES = ("ACESTEP_GEN_PARAMS",) RETURN_NAMES = ("gen_params",) @@ -455,7 +455,7 @@ class AceStepText2MusicGenParams: class AceStepSettings: """Inference settings: LM + DiT parameters.""" - CATEGORY = "ACE-Step" + CATEGORY = "api node/audio/ACE-Step" FUNCTION = "build" RETURN_TYPES = ("ACESTEP_SETTINGS",) RETURN_NAMES = ("settings",) @@ -659,7 +659,7 @@ class AceStepText2MusicServer: Inputs: serve_config fields + gen_params + settings. Outputs: audio + info + audio_codes.""" - CATEGORY = "ACE-Step" + CATEGORY = "api node/audio/ACE-Step" FUNCTION = "generate" RETURN_TYPES = ("AUDIO", "STRING", "STRING") RETURN_NAMES = ("audio", "info", "audio_codes") @@ -690,47 +690,15 @@ class AceStepText2MusicServer: headers = _make_headers(api_key) body = _build_request_body(gen_params, settings) - actual_task = body.get("task_type", "text2music") result = _post_json(f"{base}/v1/chat/completions", body, headers) audio, text_content = _parse_audio_response(result) - info_parts = [] - gp = gen_params - param_summary = ( - f"task: {actual_task}\n" - f"caption: {gp.get('caption', '')}\n" - f"lyrics: {gp.get('lyrics', '')[:80]}{'...' if len(gp.get('lyrics', '')) > 80 else ''}\n" - f"bpm: {gp.get('bpm', 0)} key: {gp.get('key_scale', '')} " - f"duration: {gp.get('duration', -1.0)} time_sig: {gp.get('time_signature', '')}\n" - f"vocal_language: {gp.get('vocal_language', '')} " - f"instrumental: {gp.get('instrumental', False)}" - ) - if actual_task == "cover": - param_summary += ( - f"\ncover_strength: {gp.get('cover_strength', 0.0)} " - f"remix_strength: {gp.get('remix_strength', 1.0)}" - ) - if gp.get("audio_codes"): - param_summary += f"\naudio_codes: {len(gp['audio_codes'])} chars" - if actual_task == "repaint": - param_summary += ( - f"\nrepaint_start: {gp.get('repaint_start', 0.0)} " - f"repaint_end: {gp.get('repaint_end', 0.0)}" - ) - info_parts.append(f"=== Gen Params ===\n{param_summary}") - - if text_content: - info_parts.append(f"\n=== Server Response ===\n{text_content}") out_codes = "" choices = result.get("choices", []) if choices: msg = choices[0].get("message", {}) out_codes = msg.get("audio_codes", "") or "" - if out_codes: - info_parts.append(f"\n=== Audio Codes ({len(out_codes)} chars) ===") - info = "\n".join(info_parts) - - return (audio, info, out_codes) + return (audio, text_content, out_codes) # ============================================================================= @@ -740,7 +708,7 @@ class AceStepText2MusicServer: class AceStepShowText: """Display any STRING input as text.""" - CATEGORY = "ACE-Step" + CATEGORY = "api node/audio/ACE-Step" FUNCTION = "show" RETURN_TYPES = ("STRING",) RETURN_NAMES = ("text",)