feat(HEL-892): pin mixed core audio separation reference contract
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -31,6 +31,7 @@ from calliope.comfyui.serialization_reference import (
|
||||
PRIMITIVE_PROFILE,
|
||||
PROFILE,
|
||||
REEL_PROFILE,
|
||||
SEPARATION_PROFILE,
|
||||
resolve_reference_link,
|
||||
serialize_case04_node,
|
||||
serialize_promoted_node,
|
||||
@@ -287,6 +288,7 @@ REFERENCE_PROFILES = (
|
||||
CASE04_PROFILE,
|
||||
ASR_PROFILE,
|
||||
*MEDIA_PROFILES,
|
||||
SEPARATION_PROFILE,
|
||||
)
|
||||
|
||||
|
||||
@@ -376,6 +378,8 @@ def media_field_evidence(source, prompt, profile):
|
||||
layouts = {
|
||||
"LoadAudio": ("audio",),
|
||||
"SaveAudioMP3": ("filename_prefix", "quality"),
|
||||
"PreviewAudio": (),
|
||||
"AudioSeparation": ("chunk_fade_shape", "chunk_length", "chunk_overlap"),
|
||||
"LoadImage": ("image",),
|
||||
"PreviewImage": (),
|
||||
"LayerUtility: ImageReel": (
|
||||
@@ -428,7 +432,9 @@ def media_field_evidence(source, prompt, profile):
|
||||
"source_pointer": pointer,
|
||||
"rule": rule,
|
||||
"profile": profile,
|
||||
"contract_manifest": "media-reference/contract.json",
|
||||
"contract_manifest": "separation-reference/contract.json"
|
||||
if profile == SEPARATION_PROFILE
|
||||
else "media-reference/contract.json",
|
||||
}
|
||||
)
|
||||
return fields
|
||||
@@ -472,12 +478,28 @@ def profile_attempt(source, profile):
|
||||
"case04-reference/sources.json",
|
||||
],
|
||||
}
|
||||
if profile == SEPARATION_PROFILE:
|
||||
assumptions["separation_reference"] = {
|
||||
"LoadAudio_and_PreviewAudio": "0.3.68@265adad858e1f31b66cd3523a02b16f5d34ced52",
|
||||
"SaveAudioMP3": "0.3.71@c55fd7481626d8bee8044ea7512ea996d13a1b90",
|
||||
"AudioSeparation": "1.4.0@5291831d7c321ab7a5192374482f9848dffee75b",
|
||||
"registry_source_bytes_match": True,
|
||||
"registry_commit_binding": "unknown; API exposes no commit",
|
||||
"plugin_license": "unknown; LICENSE referenced but absent at pinned version",
|
||||
"numeric_policy": (
|
||||
"finite int/float within frontend UI [0,2048]; saved values unchanged"
|
||||
),
|
||||
}
|
||||
assumptions["reference_sources"] = [
|
||||
"separation-reference/sources.json",
|
||||
*assumptions["reference_sources"],
|
||||
]
|
||||
base = {"profile": profile, "assumptions": assumptions}
|
||||
declared_frontend = (source.get("extra") or {}).get("frontendVersion")
|
||||
assumptions["source_frontend_declaration"] = declared_frontend
|
||||
assumptions["missing_frontend_policy"] = (
|
||||
"explicit_media_reference_assumption"
|
||||
if profile in MEDIA_PROFILES
|
||||
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE)
|
||||
else "explicit_legacy_reference_assumption"
|
||||
if profile in (PROFILE, AUX_PROFILE, PRIMITIVE_PROFILE)
|
||||
else "requires_explicit_declaration"
|
||||
@@ -490,7 +512,8 @@ def profile_attempt(source, profile):
|
||||
]
|
||||
if declared_frontend != expected and not (
|
||||
declared_frontend is None
|
||||
and profile in (PROFILE, AUX_PROFILE, PRIMITIVE_PROFILE, *MEDIA_PROFILES)
|
||||
and profile
|
||||
in (PROFILE, AUX_PROFILE, PRIMITIVE_PROFILE, *MEDIA_PROFILES, SEPARATION_PROFILE)
|
||||
):
|
||||
return {
|
||||
**base,
|
||||
@@ -527,13 +550,13 @@ def profile_attempt(source, profile):
|
||||
{"field_evidence": asr_field_evidence(source, result.prompt)}
|
||||
if profile == ASR_PROFILE
|
||||
else {"field_evidence": media_field_evidence(source, result.prompt, profile)}
|
||||
if profile in MEDIA_PROFILES
|
||||
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE)
|
||||
else {}
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def audit_library(repo: Path, profiles=REFERENCE_PROFILES):
|
||||
def audit_library(repo: Path, profiles=REFERENCE_PROFILES, *, baseline_profiles=None):
|
||||
"""Actually invoke every version-applicable profile; never choose first success.
|
||||
|
||||
The immutable manifest/SHA binding and delivery_scope define the partition.
|
||||
@@ -625,11 +648,13 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES):
|
||||
cohort: dict(Counter(r["status"] for r in rows if r["cohort"] == cohort))
|
||||
for cohort in ("without_companion", "with_companion")
|
||||
}
|
||||
if baseline_profiles is None:
|
||||
baseline_profiles = tuple(p for p in profiles if p != SEPARATION_PROFILE)
|
||||
old_complete = {
|
||||
row["source_path"]
|
||||
for row in rows
|
||||
if any(
|
||||
a["status"] == "complete_reference_candidate" and a["profile"] not in MEDIA_PROFILES
|
||||
a["status"] == "complete_reference_candidate" and a["profile"] in baseline_profiles
|
||||
for a in row["attempts"]
|
||||
)
|
||||
}
|
||||
@@ -639,7 +664,8 @@ def audit_library(repo: Path, profiles=REFERENCE_PROFILES):
|
||||
"source_total": len(manifest),
|
||||
"target_total": len(rows) + len(api_paths),
|
||||
"coverage_delta": {
|
||||
"baseline": "previous eleven profiles excluding MEDIA_PROFILES; applied this run",
|
||||
"baseline": "explicit baseline profile subset; applied this run",
|
||||
"baseline_profiles": list(baseline_profiles),
|
||||
"previous_complete_paths": sorted(old_complete),
|
||||
"current_complete_paths": sorted(now_complete),
|
||||
"new_complete_paths": sorted(now_complete - old_complete),
|
||||
@@ -677,6 +703,7 @@ def main():
|
||||
choices=(
|
||||
ASR_PROFILE,
|
||||
*MEDIA_PROFILES,
|
||||
SEPARATION_PROFILE,
|
||||
PROFILE,
|
||||
AUX_PROFILE,
|
||||
PRIMITIVE_PROFILE,
|
||||
|
||||
@@ -10,11 +10,13 @@ installation is inferred.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
from typing import Any
|
||||
|
||||
MP3_PROFILE = "comfy-frontend-1.37.11-mp3-core-0.11.0-reference"
|
||||
REEL_PROFILE = "comfy-frontend-1.37.11-layerstyle-mixed-core-0.4.0-reference"
|
||||
MEDIA_PROFILES = (MP3_PROFILE, REEL_PROFILE)
|
||||
SEPARATION_PROFILE = "comfy-frontend-1.37.11-audio-separation-1.4.0-core-mixed-reference"
|
||||
|
||||
ASR_PROFILE = "comfy-frontend-1.37.11-asr-b037d7be-reference"
|
||||
PROFILE = "comfy-frontend-1.37.11-core-reference"
|
||||
@@ -86,7 +88,7 @@ def reference_definitions(profile: str = PROFILE) -> dict[str, Any]:
|
||||
"output": outputs,
|
||||
}
|
||||
|
||||
if profile in MEDIA_PROFILES:
|
||||
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE):
|
||||
return media_definitions(profile)
|
||||
if profile == ASR_PROFILE:
|
||||
definitions = reference_definitions(PREVIEW_PROFILE)
|
||||
@@ -160,7 +162,7 @@ def reference_definitions(profile: str = PROFILE) -> dict[str, Any]:
|
||||
|
||||
def serialize_reference_widgets(node: dict[str, Any], profile: str = PROFILE) -> dict[str, Any]:
|
||||
"""Apply only the pinned identity serializers; reject any extra/missing value."""
|
||||
if profile in MEDIA_PROFILES:
|
||||
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE):
|
||||
return serialize_media_node(node, profile)
|
||||
if profile == ASR_PROFILE:
|
||||
if any(k in node for k in ("widgets", "widgets_values_named", "serializeValue")):
|
||||
@@ -1036,6 +1038,12 @@ _COMPOSIT_VERSION = "42ccdd8f75ab312285eaa77073a5cc20bdba484c"
|
||||
_MEDIA_LAYOUTS = {
|
||||
"LoadAudio": (("audio", str),),
|
||||
"SaveAudioMP3": (("filename_prefix", str), ("quality", str)),
|
||||
"PreviewAudio": (),
|
||||
"AudioSeparation": (
|
||||
("chunk_fade_shape", str),
|
||||
("chunk_length", float),
|
||||
("chunk_overlap", float),
|
||||
),
|
||||
"LoadImage": (("image", str),),
|
||||
"PreviewImage": (),
|
||||
"LayerUtility: ImageReel": (
|
||||
@@ -1065,6 +1073,15 @@ def media_definitions(profile):
|
||||
"output": outputs,
|
||||
}
|
||||
|
||||
if profile == SEPARATION_PROFILE:
|
||||
definitions = media_definitions(MP3_PROFILE)
|
||||
definitions["PreviewAudio"] = spec({"audio": "AUDIO"}, [], {"audioUI": "AUDIO_UI"})
|
||||
definitions["AudioSeparation"] = spec(
|
||||
{"audio": "AUDIO"},
|
||||
["AUDIO"] * 4,
|
||||
{"chunk_fade_shape": "COMBO", "chunk_length": "FLOAT", "chunk_overlap": "FLOAT"},
|
||||
)
|
||||
return definitions
|
||||
if profile == MP3_PROFILE:
|
||||
return {
|
||||
"LoadAudio": spec({"audio": "COMBO"}, ["AUDIO"], {"audioUI": "AUDIO_UI"}),
|
||||
@@ -1115,9 +1132,33 @@ def serialize_media_node(node, profile):
|
||||
raise ValueError("节点类型/模式不在媒体固定参考契约内")
|
||||
if any(k in node for k in ("widgets", "widgets_values_named", "serializeValue")):
|
||||
raise ValueError("媒体参考不支持自定义控件/serializer覆盖")
|
||||
provider = "comfyui_layerstyle" if ct.startswith("LayerUtility:") else "comfy-core"
|
||||
if profile == SEPARATION_PROFILE:
|
||||
if type(node.get("mode", 0)) is not int:
|
||||
raise ValueError("音频分离参考模式必须为整数0")
|
||||
ue = props.get("ue_properties") or {}
|
||||
if any(ue.get(k) for k in ("widget_ue_connectable", "input_ue_unconnectable")) or any(
|
||||
k in props for k in ("widgets", "widgets_values_named", "serializeValue")
|
||||
):
|
||||
raise ValueError("音频分离参考不覆盖自定义/UE控件改写")
|
||||
for slot, output in enumerate(node.get("outputs", [])):
|
||||
if "slot_index" in output and (
|
||||
type(output["slot_index"]) is not int or output["slot_index"] != slot
|
||||
):
|
||||
raise ValueError("音频分离输出槽索引冲突")
|
||||
provider = (
|
||||
"audio-separation-nodes-comfyui"
|
||||
if ct == "AudioSeparation"
|
||||
else ("comfyui_layerstyle" if ct.startswith("LayerUtility:") else "comfy-core")
|
||||
)
|
||||
version = (
|
||||
_REEL_VERSION
|
||||
{
|
||||
"LoadAudio": "0.3.68",
|
||||
"PreviewAudio": "0.3.68",
|
||||
"SaveAudioMP3": "0.3.71",
|
||||
"AudioSeparation": "1.4.0",
|
||||
}[ct]
|
||||
if profile == SEPARATION_PROFILE
|
||||
else _REEL_VERSION
|
||||
if ct == "LayerUtility: ImageReel"
|
||||
else _COMPOSIT_VERSION
|
||||
if ct == "LayerUtility: ImageReelComposit"
|
||||
@@ -1142,11 +1183,25 @@ def serialize_media_node(node, profile):
|
||||
raise ValueError("LoadImage上传按钮占位不符")
|
||||
result = {}
|
||||
for (name, kind), value in zip(layout, values):
|
||||
if type(value) is not kind:
|
||||
if (kind is float and type(value) not in (int, float)) or (
|
||||
kind is not float and type(value) is not kind
|
||||
):
|
||||
raise ValueError(f"媒体字段{name}类型不符")
|
||||
if kind is float and (not 0 <= value <= 2048 or not math.isfinite(value)):
|
||||
# Plugin has no min/max. This bounded profile accepts only the
|
||||
# pinned frontend constructor's default UI range, not server bounds.
|
||||
# Saved-state restore assigns directly; do not invoke onChange round.
|
||||
raise ValueError(f"媒体字段{name}超出固定前端参考范围[0,2048]")
|
||||
if kind is str and ("{" in value or "}" in value or "%" in value):
|
||||
raise ValueError(f"媒体字段{name}含未覆盖动态表达式")
|
||||
result[name] = value
|
||||
if ct == "AudioSeparation" and result["chunk_fade_shape"] not in (
|
||||
"linear",
|
||||
"half_sine",
|
||||
"logarithmic",
|
||||
"exponential",
|
||||
):
|
||||
raise ValueError("AudioSeparation chunk_fade_shape静态枚举不符")
|
||||
if ct == "SaveAudioMP3" and result["quality"] not in ("V0", "128k", "320k"):
|
||||
raise ValueError("MP3 quality静态枚举不符")
|
||||
if ct == "LayerUtility: ImageReelComposit" and result["color_theme"] not in ("light", "dark"):
|
||||
@@ -1164,7 +1219,7 @@ def serialize_media_node(node, profile):
|
||||
spec = definitions[ct]["input"]
|
||||
slots = {k: v[0] for k, v in {**spec["required"], **spec["optional"]}.items()}
|
||||
widgets = {name for name, _ in layout}
|
||||
if ct in ("LoadAudio", "SaveAudioMP3"):
|
||||
if ct in ("LoadAudio", "SaveAudioMP3", "PreviewAudio"):
|
||||
widgets.add("audioUI")
|
||||
if ct in ("LoadAudio", "LoadImage"):
|
||||
slots["upload"] = "AUDIOUPLOAD" if ct == "LoadAudio" else "IMAGEUPLOAD"
|
||||
@@ -1172,6 +1227,8 @@ def serialize_media_node(node, profile):
|
||||
sockets = node.get("inputs", [])
|
||||
if len(sockets) != len(slots) or {s.get("name") for s in sockets} != set(slots):
|
||||
raise ValueError("媒体输入槽缺失/重复/额外")
|
||||
if profile == SEPARATION_PROFILE and [s.get("name") for s in sockets] != list(slots):
|
||||
raise ValueError("音频分离参考输入/控件构造顺序不符")
|
||||
for socket in sockets:
|
||||
name = socket["name"]
|
||||
if socket.get("type") != slots[name] or socket.get("widget") != (
|
||||
@@ -1181,6 +1238,6 @@ def serialize_media_node(node, profile):
|
||||
# Do not infer widget-to-link coercions, converted widgets, or UI links.
|
||||
if name in widgets and socket.get("link") is not None:
|
||||
raise ValueError("媒体控件连线转换未证明")
|
||||
if ct in ("LoadAudio", "SaveAudioMP3"):
|
||||
if ct in ("LoadAudio", "SaveAudioMP3", "PreviewAudio"):
|
||||
result["audioUI"] = ""
|
||||
return result
|
||||
|
||||
@@ -21,6 +21,7 @@ from .serialization_reference import (
|
||||
PREVIEW_PROFILE,
|
||||
PRIMITIVE_PROFILE,
|
||||
PROFILE,
|
||||
SEPARATION_PROFILE,
|
||||
case04_definitions,
|
||||
fold_reference_primitives,
|
||||
promoted_definitions,
|
||||
@@ -61,6 +62,7 @@ def convert_reference(source: Any, profile: str = PROFILE) -> Conversion:
|
||||
PROFILE,
|
||||
ASR_PROFILE,
|
||||
*MEDIA_PROFILES,
|
||||
SEPARATION_PROFILE,
|
||||
AUX_PROFILE,
|
||||
PRIMITIVE_PROFILE,
|
||||
PREVIEW_PROFILE,
|
||||
@@ -124,10 +126,14 @@ def convert_reference(source: Any, profile: str = PROFILE) -> Conversion:
|
||||
and (source.get("extra") or {}).get("frontendVersion") != "1.37.11"
|
||||
):
|
||||
raise ValueError("PreviewAny 需要显式1.37.11前端声明")
|
||||
if profile in MEDIA_PROFILES and any(
|
||||
if profile in (*MEDIA_PROFILES, SEPARATION_PROFILE) and any(
|
||||
node.get("type") == "Reroute" for node in source.get("nodes", [])
|
||||
):
|
||||
raise ValueError("媒体最小参考仅覆盖直接连线,不扩展虚拟节点")
|
||||
if profile == SEPARATION_PROFILE and any(
|
||||
(source.get("extra") or {}).get(k) for k in ("ue_links", "links_added_by_ue")
|
||||
):
|
||||
raise ValueError("音频分离参考不覆盖UE附加连线")
|
||||
original = source
|
||||
if profile in (PRIMITIVE_PROFILE, PREVIEW_PROFILE):
|
||||
source = fold_reference_primitives(source, profile)
|
||||
@@ -139,7 +145,7 @@ def convert_reference(source: Any, profile: str = PROFILE) -> Conversion:
|
||||
except (ValueError, TypeError, KeyError, AttributeError, IndexError) as exc:
|
||||
return Conversion(None, [{"code": "invalid_reference_contract", "message": str(exc)}], True)
|
||||
result.reference_only = True
|
||||
if profile in (ASR_PROFILE, *MEDIA_PROFILES):
|
||||
if profile in (ASR_PROFILE, *MEDIA_PROFILES, SEPARATION_PROFILE):
|
||||
result.serialization_stage = "restored_saved_state_before_queue_hooks"
|
||||
return result
|
||||
|
||||
@@ -220,7 +226,7 @@ def _convert(
|
||||
for lid in links:
|
||||
try:
|
||||
resolve_reference_link(nodes, links, lid)
|
||||
if reference_profile in MEDIA_PROFILES:
|
||||
if reference_profile in (*MEDIA_PROFILES, SEPARATION_PROFILE):
|
||||
link = links[lid]
|
||||
upstream = nodes[str(link[1])]["outputs"][link[2]]
|
||||
downstream = nodes[str(link[3])]["inputs"][link[4]]
|
||||
@@ -272,7 +278,13 @@ def _convert(
|
||||
allowed = set(declared) | ({"upload"} if ct == "LoadImage" else set())
|
||||
if (
|
||||
reference_profile
|
||||
in (PRIMITIVE_PROFILE, PREVIEW_PROFILE, ASR_PROFILE, *MEDIA_PROFILES)
|
||||
in (
|
||||
PRIMITIVE_PROFILE,
|
||||
PREVIEW_PROFILE,
|
||||
ASR_PROFILE,
|
||||
*MEDIA_PROFILES,
|
||||
SEPARATION_PROFILE,
|
||||
)
|
||||
and ct == "LoadAudio"
|
||||
):
|
||||
allowed |= {"upload", "audioUI"}
|
||||
|
||||
@@ -0,0 +1,414 @@
|
||||
"""Pinned source AST, actual saved graph, synthetic mutations; no upstream execution."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
import copy
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from scripts import audit_reference_conversion as audit
|
||||
|
||||
from calliope.comfyui.serialization_reference import MP3_PROFILE, SEPARATION_PROFILE
|
||||
from calliope.comfyui.ui2api import convert, convert_reference
|
||||
|
||||
REPO = Path(__file__).resolve().parents[2]
|
||||
SOURCE = (
|
||||
"example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/"
|
||||
"视频-音频分离.json"
|
||||
)
|
||||
SOURCES = REPO / "docs/hel-892/separation-reference"
|
||||
|
||||
|
||||
def graph():
|
||||
return json.loads((REPO / SOURCE).read_bytes())
|
||||
|
||||
|
||||
def node(source, nid):
|
||||
return next(n for n in source["nodes"] if n["id"] == nid)
|
||||
|
||||
|
||||
def converted(source):
|
||||
result = convert_reference(source, SEPARATION_PROFILE)
|
||||
assert result.reference_only
|
||||
return result
|
||||
|
||||
|
||||
def test_original_plugin_schema_registration_and_artifact_bytes_without_import():
|
||||
raw = (SOURCES / "plugin-5291831d__src__separation.py").read_bytes()
|
||||
assert raw == (SOURCES / "registry__src__separation.py").read_bytes()
|
||||
tree = ast.parse(raw)
|
||||
cls = next(n for n in tree.body if isinstance(n, ast.ClassDef) and n.name == "AudioSeparation")
|
||||
method = next(n for n in cls.body if isinstance(n, ast.FunctionDef) and n.name == "INPUT_TYPES")
|
||||
schema = ast.literal_eval(next(n.value for n in ast.walk(method) if isinstance(n, ast.Return)))
|
||||
assert list(schema["required"]) == ["audio"]
|
||||
assert list(schema["optional"]) == ["chunk_fade_shape", "chunk_length", "chunk_overlap"]
|
||||
assert schema["optional"]["chunk_fade_shape"][0] == [
|
||||
"linear",
|
||||
"half_sine",
|
||||
"logarithmic",
|
||||
"exponential",
|
||||
]
|
||||
for field in ("chunk_length", "chunk_overlap"):
|
||||
assert schema["optional"][field][0] == "FLOAT"
|
||||
assert not {"min", "max"}.intersection(schema["optional"][field][1])
|
||||
attrs = {
|
||||
n.targets[0].id: ast.literal_eval(n.value)
|
||||
for n in cls.body
|
||||
if isinstance(n, ast.Assign) and isinstance(n.targets[0], ast.Name)
|
||||
}
|
||||
assert attrs["RETURN_TYPES"] == ("AUDIO",) * 4
|
||||
assert attrs["RETURN_NAMES"] == ("Bass", "Drums", "Other", "Vocals")
|
||||
output_method = next(
|
||||
n for n in cls.body if isinstance(n, ast.FunctionDef) and n.name == "sources_to_tuple"
|
||||
)
|
||||
order = next(
|
||||
n
|
||||
for n in ast.walk(output_method)
|
||||
if isinstance(n, ast.Assign)
|
||||
and any(isinstance(t, ast.Name) and t.id == "output_order" for t in n.targets)
|
||||
)
|
||||
assert ast.literal_eval(order.value) == ["bass", "drums", "other", "vocals"]
|
||||
tree = ast.parse((SOURCES / "plugin-5291831d____init__.py").read_text())
|
||||
mapping = next(n.value for n in tree.body if isinstance(n, ast.Assign))
|
||||
assert ("AudioSeparation", "AudioSeparation") in [
|
||||
(k.value, v.id) for k, v in zip(mapping.keys, mapping.values)
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"version,classes", [("0.3.68", ["LoadAudio", "PreviewAudio"]), ("0.3.71", ["SaveAudioMP3"])]
|
||||
)
|
||||
def test_each_pinned_core_definition_and_registration_has_its_own_identity(version, classes):
|
||||
tree = ast.parse((SOURCES / f"core-{version}__comfy_extras__nodes_audio.py").read_text())
|
||||
mapping = next(
|
||||
n.value
|
||||
for n in tree.body
|
||||
if isinstance(n, ast.Assign)
|
||||
and any(isinstance(t, ast.Name) and t.id == "NODE_CLASS_MAPPINGS" for t in n.targets)
|
||||
)
|
||||
names = {k.value: v.id for k, v in zip(mapping.keys, mapping.values)}
|
||||
expected = {
|
||||
"LoadAudio": ["audio"],
|
||||
"PreviewAudio": ["audio"],
|
||||
"SaveAudioMP3": ["audio", "filename_prefix", "quality"],
|
||||
}
|
||||
for name in classes:
|
||||
assert names[name] == name
|
||||
cls = next(n for n in tree.body if isinstance(n, ast.ClassDef) and n.name == name)
|
||||
method = next(
|
||||
n for n in cls.body if isinstance(n, ast.FunctionDef) and n.name == "INPUT_TYPES"
|
||||
)
|
||||
schema = next(n.value for n in ast.walk(method) if isinstance(n, ast.Return))
|
||||
required = next(v for k, v in zip(schema.keys, schema.values) if k.value == "required")
|
||||
assert [k.value for k in required.keys] == expected[name]
|
||||
if name == "SaveAudioMP3":
|
||||
assert ast.literal_eval(required.values[2])[0] == ["V0", "128k", "320k"]
|
||||
if name == "PreviewAudio":
|
||||
assert cls.bases[0].id == "SaveAudio"
|
||||
|
||||
|
||||
def test_real_graph_complete_candidate_independently_checks_every_field_and_pointer():
|
||||
source = graph()
|
||||
original = copy.deepcopy(source)
|
||||
result = converted(source)
|
||||
assert source == original and convert(source).prompt is None
|
||||
assert (
|
||||
not result.issues
|
||||
and result.serialization_stage == "restored_saved_state_before_queue_hooks"
|
||||
)
|
||||
prompt = result.prompt
|
||||
assert prompt is not None and len(prompt) == 7
|
||||
layouts = {
|
||||
"SaveAudioMP3": ["filename_prefix", "quality"],
|
||||
"LoadAudio": ["audio"],
|
||||
"PreviewAudio": [],
|
||||
"AudioSeparation": ["chunk_fade_shape", "chunk_length", "chunk_overlap"],
|
||||
}
|
||||
for n in source["nodes"]:
|
||||
actual = prompt[str(n["id"])]
|
||||
assert actual["class_type"] == n["type"] and actual["_meta"] == {"title": n["type"]}
|
||||
expected = dict(zip(layouts[n["type"]], n["widgets_values"]))
|
||||
if n["type"] != "AudioSeparation":
|
||||
expected["audioUI"] = ""
|
||||
for socket in n["inputs"]:
|
||||
if socket["link"] is not None:
|
||||
link = next(link for link in source["links"] if link[0] == socket["link"])
|
||||
expected[socket["name"]] = [str(link[1]), link[2]]
|
||||
assert actual["inputs"] == expected
|
||||
assert {k: type(v) for k, v in actual["inputs"].items()} == {
|
||||
k: type(v) for k, v in expected.items()
|
||||
}
|
||||
assert prompt["17"]["inputs"]["audio"] == ["10", 0] # original audio, NOT a separated stem
|
||||
assert {nid: prompt[nid]["inputs"]["audio"] for nid in ("18", "19", "20", "15")} == {
|
||||
"18": ["11", 0],
|
||||
"19": ["11", 1],
|
||||
"20": ["11", 2],
|
||||
"15": ["11", 3],
|
||||
}
|
||||
assert type(prompt["11"]["inputs"]["chunk_length"]) is int
|
||||
assert prompt["11"]["inputs"]["chunk_overlap"] == 0.2
|
||||
attempt = audit.profile_attempt(source, SEPARATION_PROFILE)
|
||||
assert attempt["candidate_prompt"] == prompt
|
||||
assert attempt["candidate_sha256"] == audit.canonical_sha(prompt)
|
||||
assert attempt["assumptions"]["source_frontend_declaration"] is None
|
||||
assert attempt["assumptions"]["missing_node_declarations"] == []
|
||||
assert attempt["assumptions"]["target_version_match"] == "unknown"
|
||||
fields = attempt["field_evidence"]
|
||||
assert len(fields) == 18
|
||||
for field in fields:
|
||||
if field["source_pointer"] is None:
|
||||
assert field["field"] == "audioUI" and field["value"] == ""
|
||||
continue
|
||||
value = source
|
||||
for part in field["source_pointer"].split("/")[1:]:
|
||||
value = value[int(part)] if isinstance(value, list) else value[part]
|
||||
expected = (
|
||||
[str(value[1]), value[2]] if field["source_pointer"].startswith("/links/") else value
|
||||
)
|
||||
assert type(expected) is type(field["value"]) and expected == field["value"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("shape", ["linear", "half_sine", "logarithmic", "exponential"])
|
||||
@pytest.mark.parametrize(
|
||||
"length,overlap", [(20, 0.2), (20.0, 1), (0, 0.0), (2048, 2048.0), (1.25, 0.123456)]
|
||||
)
|
||||
def test_changed_float_values_and_enums_preserve_exact_saved_numeric_form(shape, length, overlap):
|
||||
source = graph()
|
||||
node(source, 11)["widgets_values"] = [shape, length, overlap]
|
||||
actual = converted(source).prompt["11"]["inputs"]
|
||||
assert actual["chunk_fade_shape"] == shape
|
||||
assert type(actual["chunk_length"]) is type(length) and actual["chunk_length"] == length
|
||||
assert type(actual["chunk_overlap"]) is type(overlap) and actual["chunk_overlap"] == overlap
|
||||
|
||||
|
||||
@pytest.mark.parametrize("quality", ["V0", "128k", "320k"])
|
||||
def test_prefix_and_quality_and_audio_name_propagate(quality):
|
||||
source = graph()
|
||||
node(source, 17)["widgets_values"] = ["新目录/前缀", quality]
|
||||
node(source, 10)["widgets_values"][0] = "第二段 音频.mp4"
|
||||
prompt = converted(source).prompt
|
||||
assert prompt["17"]["inputs"]["quality"] == quality
|
||||
assert prompt["17"]["inputs"]["filename_prefix"] == "新目录/前缀"
|
||||
assert prompt["10"]["inputs"]["audio"] == "第二段 音频.mp4"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("index", [1, 2])
|
||||
@pytest.mark.parametrize(
|
||||
"bad", [True, False, None, "20", [], -0.1, 2048.01, float("nan"), float("inf"), 10**1000]
|
||||
)
|
||||
def test_invalid_numeric_type_or_frontend_bound_closes_whole_graph(index, bad):
|
||||
source = graph()
|
||||
node(source, 11)["widgets_values"][index] = bad
|
||||
result = converted(source)
|
||||
assert result.prompt is None and result.issues
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mutation",
|
||||
[
|
||||
"enum",
|
||||
"null_enum",
|
||||
"extra_widget",
|
||||
"missing_widget",
|
||||
"preview_widget",
|
||||
"load_dom",
|
||||
"quality",
|
||||
"version",
|
||||
"plugin_version",
|
||||
"provider",
|
||||
"missing_version",
|
||||
"swap_core",
|
||||
"frontend",
|
||||
"serializer",
|
||||
"named_override",
|
||||
"ue_override",
|
||||
"ue_link",
|
||||
"bad_widget",
|
||||
"socket_type",
|
||||
"missing_socket",
|
||||
"socket_order",
|
||||
"extra_output",
|
||||
"output_index",
|
||||
"bad_slot",
|
||||
"bool_slot",
|
||||
"link_type",
|
||||
"dangling",
|
||||
"unused_bad_link",
|
||||
"muted",
|
||||
"bool_mode",
|
||||
"unknown_node",
|
||||
"dynamic_prefix",
|
||||
"preview_audio_ui_link",
|
||||
],
|
||||
)
|
||||
def test_unsupported_layout_version_override_and_structure_fail_closed(mutation):
|
||||
source = graph()
|
||||
separation = node(source, 11)
|
||||
if mutation == "enum":
|
||||
separation["widgets_values"][0] = "cosine"
|
||||
elif mutation == "null_enum":
|
||||
separation["widgets_values"][0] = None
|
||||
elif mutation == "extra_widget":
|
||||
separation["widgets_values"].append(1)
|
||||
elif mutation == "missing_widget":
|
||||
separation["widgets_values"].pop()
|
||||
elif mutation == "preview_widget":
|
||||
node(source, 15)["widgets_values"] = [None]
|
||||
elif mutation == "load_dom":
|
||||
node(source, 10)["widgets_values"][1] = "audio/server.wav"
|
||||
elif mutation == "quality":
|
||||
node(source, 17)["widgets_values"][1] = "invalid"
|
||||
elif mutation == "version":
|
||||
node(source, 10)["properties"]["ver"] = "0.11.0"
|
||||
elif mutation == "plugin_version":
|
||||
separation["properties"]["ver"] = "1.5.0"
|
||||
elif mutation == "provider":
|
||||
separation["properties"]["cnr_id"] = "other"
|
||||
elif mutation == "missing_version":
|
||||
separation["properties"].pop("ver")
|
||||
elif mutation == "swap_core":
|
||||
node(source, 17)["properties"]["ver"] = "0.3.68"
|
||||
elif mutation == "frontend":
|
||||
source["extra"]["frontendVersion"] = "1.53.6"
|
||||
elif mutation == "serializer":
|
||||
separation["serializeValue"] = "custom"
|
||||
elif mutation == "named_override":
|
||||
separation["widgets_values_named"] = {"chunk_length": 1}
|
||||
elif mutation == "ue_override":
|
||||
separation["properties"]["ue_properties"]["widget_ue_connectable"] = {"chunk_length": True}
|
||||
elif mutation == "ue_link":
|
||||
source["extra"]["ue_links"] = [[1, 2]]
|
||||
elif mutation == "bad_widget":
|
||||
separation["inputs"][1]["widget"] = {"name": "wrong"}
|
||||
elif mutation == "socket_type":
|
||||
separation["inputs"][2]["type"] = "INT"
|
||||
elif mutation == "missing_socket":
|
||||
separation["inputs"].pop()
|
||||
elif mutation == "socket_order":
|
||||
separation["inputs"][1:3] = reversed(separation["inputs"][1:3])
|
||||
elif mutation == "extra_output":
|
||||
separation["outputs"].append({"name": "other", "type": "AUDIO", "links": []})
|
||||
elif mutation == "output_index":
|
||||
separation["outputs"][3]["slot_index"] = 0
|
||||
elif mutation == "bad_slot":
|
||||
source["links"][1][2] = 4
|
||||
elif mutation == "bool_slot":
|
||||
source["links"][1][2] = True
|
||||
elif mutation == "link_type":
|
||||
source["links"][1][5] = "IMAGE"
|
||||
elif mutation == "dangling":
|
||||
source["links"][1][1] = 99
|
||||
elif mutation == "unused_bad_link":
|
||||
source["links"].append([999, 11, 0, 15, 0, "AUDIO"])
|
||||
elif mutation == "muted":
|
||||
node(source, 15)["mode"] = 2
|
||||
elif mutation == "bool_mode":
|
||||
node(source, 15)["mode"] = False
|
||||
elif mutation == "unknown_node":
|
||||
node(source, 15)["type"] = "UnknownPreview"
|
||||
elif mutation == "dynamic_prefix":
|
||||
node(source, 17)["widgets_values"][0] = "%date%/audio"
|
||||
elif mutation == "preview_audio_ui_link":
|
||||
node(source, 15)["inputs"][1]["link"] = 15
|
||||
result = converted(source)
|
||||
assert result.prompt is None and result.issues
|
||||
|
||||
|
||||
def test_two_independent_graph_instances_keep_all_four_nonzero_slots_and_scalars():
|
||||
source = graph()
|
||||
other = graph()
|
||||
for n in other["nodes"]:
|
||||
n["id"] += 100
|
||||
for socket in n["inputs"]:
|
||||
if socket.get("link") is not None:
|
||||
socket["link"] += 1000
|
||||
for socket in n["outputs"]:
|
||||
socket["links"] = [lid + 1000 for lid in socket.get("links", [])]
|
||||
for link in other["links"]:
|
||||
link[0] += 1000
|
||||
link[1] += 100
|
||||
link[3] += 100
|
||||
node(other, 111)["widgets_values"] = ["exponential", 7.5, 0.375]
|
||||
node(other, 117)["widgets_values"] = ["第二路/音频", "128k"]
|
||||
node(other, 110)["widgets_values"][0] = "second.wav"
|
||||
source["nodes"].extend(other["nodes"])
|
||||
source["links"].extend(other["links"])
|
||||
prompt = converted(source).prompt
|
||||
assert len(prompt) == 14
|
||||
for out, slot in [(18, 0), (19, 1), (20, 2), (15, 3)]:
|
||||
assert prompt[str(out)]["inputs"]["audio"] == ["11", slot]
|
||||
assert prompt[str(out + 100)]["inputs"]["audio"] == ["111", slot]
|
||||
assert prompt["11"]["inputs"]["chunk_length"] == 20
|
||||
assert prompt["111"]["inputs"]["chunk_length"] == 7.5
|
||||
assert prompt["117"]["inputs"]["audio"] == ["110", 0]
|
||||
assert prompt["17"]["inputs"]["audio"] == ["10", 0]
|
||||
assert prompt["117"]["inputs"]["filename_prefix"] == "第二路/音频"
|
||||
|
||||
|
||||
def test_old_mp3_profile_rejects_real_graph_and_new_profile_rejects_old_core():
|
||||
source = graph()
|
||||
assert convert_reference(source, MP3_PROFILE).prompt is None
|
||||
for n in source["nodes"]:
|
||||
if n["properties"]["cnr_id"] == "comfy-core":
|
||||
n["properties"]["ver"] = "0.11.0"
|
||||
assert converted(source).prompt is None
|
||||
|
||||
|
||||
def test_library_actual_delta_keeps_every_old_attempt_and_all_six_golden_comparisons():
|
||||
previous = json.loads((REPO / "docs/hel-892/media-evidence/library.json").read_bytes())
|
||||
baseline = tuple(p for p in audit.REFERENCE_PROFILES if p != SEPARATION_PROFILE)
|
||||
old = audit.audit_library(REPO, baseline)
|
||||
current = audit.audit_library(REPO)
|
||||
for historical, before, after in zip(previous["cases"], old["cases"], current["cases"]):
|
||||
assert historical["source_path"] == before["source_path"] == after["source_path"]
|
||||
assert historical["attempts"] == before["attempts"] == after["attempts"][:-1]
|
||||
assert historical.get("comparisons") == before.get("comparisons")
|
||||
old_comparisons = [c for c in after.get("comparisons", []) if c["profile"] in baseline]
|
||||
assert old_comparisons == before.get("comparisons", [])
|
||||
assert current["coverage_delta"]["baseline_profiles"] == list(baseline)
|
||||
assert current["coverage_delta"]["new_complete_paths"] == [SOURCE]
|
||||
assert current["ui_total"] == 145
|
||||
row = next(r for r in current["cases"] if r["source_path"] == SOURCE)
|
||||
assert row["source_sha256"] == hashlib.sha256((REPO / SOURCE).read_bytes()).hexdigest()
|
||||
assert row["comparison_status"] == "comparison_unavailable" and "comparisons" not in row
|
||||
assert not row["production_prompt_available"] and not row["execution_verified"]
|
||||
assert all(
|
||||
"candidate_prompt" not in a
|
||||
for r in current["cases"]
|
||||
for a in r["attempts"]
|
||||
if a["status"] != "complete_reference_candidate"
|
||||
)
|
||||
|
||||
# Other frontends remain out of scope: all-not-applicable set is identical.
|
||||
def unavailable(report):
|
||||
return {
|
||||
r["source_path"]
|
||||
for r in report["cases"]
|
||||
if all(a["status"] == "not_applicable" for a in r["attempts"])
|
||||
}
|
||||
|
||||
assert unavailable(previous) == unavailable(current)
|
||||
|
||||
|
||||
async def test_synthetic_preview_and_mp3_history_only_accept_file_descriptors():
|
||||
from calliope.comfyui.client import ComfyUIClient
|
||||
|
||||
client = ComfyUIClient("http://unused.invalid")
|
||||
# Synthetic protocol fixture, not real encoding, history, or separation.
|
||||
fixture = {
|
||||
"outputs": {
|
||||
nid: {
|
||||
"audio": [
|
||||
{"filename": f"synthetic_{nid}.{ext}", "subfolder": "audio", "type": kind}
|
||||
]
|
||||
}
|
||||
for nid, ext, kind in [("15", "flac", "temp"), ("17", "mp3", "output")]
|
||||
}
|
||||
}
|
||||
assert len(client.extract_outputs(fixture, {"15": "audio", "17": "audio"})) == 2
|
||||
for bad in ["/server/audio.mp3", "https://example.invalid/a.mp3", "", {"audioUI": ""}]:
|
||||
assert client.extract_outputs({"outputs": {"15": {"audio": [bad]}}}, {"15": "audio"}) == []
|
||||
await client.close()
|
||||
@@ -251,9 +251,22 @@ def test_mixed_plugin_commits_cannot_be_interchanged():
|
||||
|
||||
def test_library_actual_delta_keeps_old_candidates_and_no_golden_claim():
|
||||
previous = audit.audit_library(
|
||||
REPO, tuple(p for p in audit.REFERENCE_PROFILES if p not in MEDIA_PROFILES)
|
||||
REPO,
|
||||
tuple(
|
||||
p
|
||||
for p in audit.REFERENCE_PROFILES
|
||||
if p not in MEDIA_PROFILES and p != audit.SEPARATION_PROFILE
|
||||
),
|
||||
)
|
||||
current = audit.audit_library(
|
||||
REPO,
|
||||
tuple(p for p in audit.REFERENCE_PROFILES if p != audit.SEPARATION_PROFILE),
|
||||
baseline_profiles=tuple(
|
||||
p
|
||||
for p in audit.REFERENCE_PROFILES
|
||||
if p not in MEDIA_PROFILES and p != audit.SEPARATION_PROFILE
|
||||
),
|
||||
)
|
||||
current = audit.audit_library(REPO)
|
||||
assert (
|
||||
current["coverage_delta"]["previous_complete_paths"]
|
||||
== previous["coverage_delta"]["current_complete_paths"]
|
||||
|
||||
@@ -0,0 +1,438 @@
|
||||
{
|
||||
"authority": "public_reference_only_not_object_info",
|
||||
"serialization_stage": "restored_saved_state_before_queue_hooks",
|
||||
"source_path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/视频-音频分离.json",
|
||||
"source_sha256": "4861e3e33291ed962d2215b1d8cc976a4706d19719e3541e9cbb2c636683afc3",
|
||||
"frontend": {
|
||||
"source_declaration": null,
|
||||
"selected_tag": "1.37.11",
|
||||
"selected_commit": "4bf6a1960028cc5cda57d48f9fb01a74dfaade43",
|
||||
"selection": "explicit reference assumption only, not inferred source/target match",
|
||||
"unmodified_frontend_and_widgets_assumed": true,
|
||||
"ue_serializer_match": "unknown"
|
||||
},
|
||||
"node_versions": {
|
||||
"17": {
|
||||
"type": "SaveAudioMP3",
|
||||
"provider": "comfy-core",
|
||||
"version": "0.3.71",
|
||||
"ue_version": "7.5.2",
|
||||
"source_pointer": "/nodes/0/properties",
|
||||
"target_installation_match": "unknown"
|
||||
},
|
||||
"10": {
|
||||
"type": "LoadAudio",
|
||||
"provider": "comfy-core",
|
||||
"version": "0.3.68",
|
||||
"ue_version": "7.4.1",
|
||||
"source_pointer": "/nodes/1/properties",
|
||||
"target_installation_match": "unknown"
|
||||
},
|
||||
"20": {
|
||||
"type": "PreviewAudio",
|
||||
"provider": "comfy-core",
|
||||
"version": "0.3.68",
|
||||
"ue_version": "7.4.1",
|
||||
"source_pointer": "/nodes/2/properties",
|
||||
"target_installation_match": "unknown"
|
||||
},
|
||||
"15": {
|
||||
"type": "PreviewAudio",
|
||||
"provider": "comfy-core",
|
||||
"version": "0.3.68",
|
||||
"ue_version": "7.4.1",
|
||||
"source_pointer": "/nodes/3/properties",
|
||||
"target_installation_match": "unknown"
|
||||
},
|
||||
"19": {
|
||||
"type": "PreviewAudio",
|
||||
"provider": "comfy-core",
|
||||
"version": "0.3.68",
|
||||
"ue_version": "7.4.1",
|
||||
"source_pointer": "/nodes/4/properties",
|
||||
"target_installation_match": "unknown"
|
||||
},
|
||||
"18": {
|
||||
"type": "PreviewAudio",
|
||||
"provider": "comfy-core",
|
||||
"version": "0.3.68",
|
||||
"ue_version": "7.4.1",
|
||||
"source_pointer": "/nodes/5/properties",
|
||||
"target_installation_match": "unknown"
|
||||
},
|
||||
"11": {
|
||||
"type": "AudioSeparation",
|
||||
"provider": "audio-separation-nodes-comfyui",
|
||||
"version": "1.4.0",
|
||||
"ue_version": "7.4.1",
|
||||
"source_pointer": "/nodes/6/properties",
|
||||
"target_installation_match": "unknown"
|
||||
}
|
||||
},
|
||||
"core_versions": {
|
||||
"0.3.68": {
|
||||
"commit": "265adad858e1f31b66cd3523a02b16f5d34ced52",
|
||||
"classes": [
|
||||
"LoadAudio",
|
||||
"PreviewAudio"
|
||||
],
|
||||
"schema": "comfy_extras/nodes_audio.py",
|
||||
"registrations": {
|
||||
"LoadAudio": [
|
||||
586,
|
||||
586
|
||||
],
|
||||
"PreviewAudio": [
|
||||
587,
|
||||
587
|
||||
]
|
||||
},
|
||||
"license": "GPL-3.0",
|
||||
"exact_rule_locations": {
|
||||
"SaveAudio definition": [
|
||||
196,
|
||||
218
|
||||
],
|
||||
"SaveAudioMP3 definition": [
|
||||
220,
|
||||
243
|
||||
],
|
||||
"PreviewAudio definition": [
|
||||
270,
|
||||
281
|
||||
],
|
||||
"LoadAudio definition": [
|
||||
319,
|
||||
349
|
||||
],
|
||||
"SaveAudioMP3 registration": [
|
||||
584,
|
||||
584
|
||||
],
|
||||
"LoadAudio registration": [
|
||||
586,
|
||||
586
|
||||
],
|
||||
"PreviewAudio registration": [
|
||||
587,
|
||||
587
|
||||
],
|
||||
"save_audio UI descriptors": [
|
||||
187,
|
||||
194
|
||||
],
|
||||
"MP3 codec options": [
|
||||
158,
|
||||
173
|
||||
]
|
||||
},
|
||||
"definitions": {
|
||||
"LoadAudio": [
|
||||
319,
|
||||
349
|
||||
],
|
||||
"PreviewAudio": [
|
||||
270,
|
||||
281
|
||||
]
|
||||
}
|
||||
},
|
||||
"0.3.71": {
|
||||
"commit": "c55fd7481626d8bee8044ea7512ea996d13a1b90",
|
||||
"classes": [
|
||||
"SaveAudioMP3"
|
||||
],
|
||||
"license": "GPL-3.0",
|
||||
"exact_rule_locations": {
|
||||
"SaveAudio definition": [
|
||||
196,
|
||||
218
|
||||
],
|
||||
"SaveAudioMP3 definition": [
|
||||
220,
|
||||
243
|
||||
],
|
||||
"PreviewAudio definition": [
|
||||
270,
|
||||
281
|
||||
],
|
||||
"LoadAudio definition": [
|
||||
319,
|
||||
349
|
||||
],
|
||||
"SaveAudioMP3 registration": [
|
||||
584,
|
||||
584
|
||||
],
|
||||
"LoadAudio registration": [
|
||||
586,
|
||||
586
|
||||
],
|
||||
"PreviewAudio registration": [
|
||||
587,
|
||||
587
|
||||
],
|
||||
"save_audio UI descriptors": [
|
||||
187,
|
||||
194
|
||||
],
|
||||
"MP3 codec options": [
|
||||
158,
|
||||
173
|
||||
]
|
||||
},
|
||||
"definitions": {
|
||||
"SaveAudioMP3": [
|
||||
220,
|
||||
243
|
||||
]
|
||||
},
|
||||
"registrations": {
|
||||
"SaveAudioMP3": [
|
||||
584,
|
||||
584
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"plugin": {
|
||||
"repository": "https://github.com/christian-byrne/audio-separation-nodes-comfyui",
|
||||
"reference_commit": "5291831d7c321ab7a5192374482f9848dffee75b",
|
||||
"declared_version": "1.4.0",
|
||||
"version_definition": "pyproject.toml:4",
|
||||
"class_definition": "src/separation.py:14",
|
||||
"registration": "__init__.py:11",
|
||||
"registry_source_match": "selected source, registration, project metadata, publish workflow and README match 1.4.0 artifact bytes exactly; see discovery.json",
|
||||
"registry_commit_binding": "unknown; API supplies no commit, source-byte agreement is not a signed release mapping",
|
||||
"license": "unknown; pyproject names LICENSE but pinned tree/package contain no license file. Do not copy later MIT declaration onto 1.4.0",
|
||||
"no_plugin_js_at_reference_commit": true,
|
||||
"target_installation_match": "unknown"
|
||||
},
|
||||
"widget_layouts": {
|
||||
"LoadAudio": [
|
||||
"audio COMBO",
|
||||
"audioUI DOM hole (serialize=false)",
|
||||
"upload button (options.serialize=false)"
|
||||
],
|
||||
"SaveAudioMP3": [
|
||||
"filename_prefix STRING",
|
||||
"quality COMBO",
|
||||
"audioUI nonpersisted tail DOM"
|
||||
],
|
||||
"PreviewAudio": [
|
||||
"audioUI nonpersisted tail DOM"
|
||||
],
|
||||
"AudioSeparation": [
|
||||
"chunk_fade_shape COMBO",
|
||||
"chunk_length FLOAT",
|
||||
"chunk_overlap FLOAT"
|
||||
]
|
||||
},
|
||||
"saved_shapes": {
|
||||
"LoadAudio": [
|
||||
"file string",
|
||||
null,
|
||||
null
|
||||
],
|
||||
"SaveAudioMP3": [
|
||||
"audio/ComfyUI",
|
||||
"320k"
|
||||
],
|
||||
"PreviewAudio": [],
|
||||
"AudioSeparation": [
|
||||
"half_sine",
|
||||
20,
|
||||
0.2
|
||||
]
|
||||
},
|
||||
"numeric_contract": {
|
||||
"plugin_min_max": "not declared for either FLOAT",
|
||||
"frontend_constructor_range": [
|
||||
0,
|
||||
2048
|
||||
],
|
||||
"range_policy": "bounded reference profile restricts finite int/float to pinned frontend default UI limits; not a server/model-valid range claim",
|
||||
"restore_policy": "LGraphNode.configure assigns widget.value directly, without float callback; do not round or replace source values with defaults",
|
||||
"bool_policy": "reject; Python bool is not accepted as numeric",
|
||||
"source_values": {
|
||||
"chunk_length": {
|
||||
"value": 20,
|
||||
"parsed_type": "int"
|
||||
},
|
||||
"chunk_overlap": {
|
||||
"value": 0.2,
|
||||
"parsed_type": "float"
|
||||
}
|
||||
},
|
||||
"units_reference": "source tooltip says seconds; target meaning/effect unverified. separate_sources uses sample_rate*segment*(1+overlap) and overlap*sample_rate; do not assert alternative units, safe cross-parameter ranges, or performance"
|
||||
},
|
||||
"enums": {
|
||||
"chunk_fade_shape": [
|
||||
"linear",
|
||||
"half_sine",
|
||||
"logarithmic",
|
||||
"exponential"
|
||||
],
|
||||
"quality": [
|
||||
"V0",
|
||||
"128k",
|
||||
"320k"
|
||||
]
|
||||
},
|
||||
"output_order": {
|
||||
"types": [
|
||||
"AUDIO",
|
||||
"AUDIO",
|
||||
"AUDIO",
|
||||
"AUDIO"
|
||||
],
|
||||
"reference_names": [
|
||||
"Bass",
|
||||
"Drums",
|
||||
"Other",
|
||||
"Vocals"
|
||||
],
|
||||
"actual_return_order": [
|
||||
"bass",
|
||||
"drums",
|
||||
"other",
|
||||
"vocals"
|
||||
],
|
||||
"source_labels": [
|
||||
"低音",
|
||||
"鼓",
|
||||
"其他",
|
||||
"人声"
|
||||
],
|
||||
"source_slot_to_preview": {
|
||||
"0": "18",
|
||||
"1": "19",
|
||||
"2": "20",
|
||||
"3": "15"
|
||||
},
|
||||
"mp3_source": [
|
||||
"10",
|
||||
0
|
||||
],
|
||||
"mp3_is_separated_stem": false
|
||||
},
|
||||
"protocol": {
|
||||
"PreviewAudio": "inherits SaveAudio.save_flac, temp directory/type, random prefix; save_audio returns ui.audio file descriptors",
|
||||
"SaveAudioMP3": "calls save_audio(format=mp3), output type; saved quality320k overrides function default128k; no actual codec run",
|
||||
"descriptor_keys": [
|
||||
"filename",
|
||||
"subfolder",
|
||||
"type"
|
||||
],
|
||||
"history_chain": "save_audio ui.audio -> get_output_from_returns UI merge -> UI cache -> history_result.outputs -> PromptQueue.task_done.history",
|
||||
"audioUI": "frontend DOM getter returns empty string without getValue; not a file descriptor",
|
||||
"downloads": "existing ComfyUIClient.extract_outputs and /view chain, synthetic protocol fixture only; strings/URLs/paths rejected",
|
||||
"production_output_registration": "unchanged; reference profile never registers or auto-trusts PreviewAudio/unknown names"
|
||||
},
|
||||
"reused_frontend_rules": [
|
||||
{
|
||||
"manifest": "../serialization-evidence/sources.json",
|
||||
"file": "src/services/litegraphService.ts",
|
||||
"lines": [
|
||||
[
|
||||
305,
|
||||
406
|
||||
]
|
||||
],
|
||||
"purpose": "required then optional input constructor order"
|
||||
},
|
||||
{
|
||||
"manifest": "../serialization-evidence/sources.json",
|
||||
"file": "src/lib/litegraph/src/LGraphNode.ts",
|
||||
"lines": [
|
||||
[
|
||||
867,
|
||||
878
|
||||
],
|
||||
[
|
||||
914,
|
||||
921
|
||||
]
|
||||
],
|
||||
"purpose": "restore skips widget.serialize=false; persist retains original widget indices"
|
||||
},
|
||||
{
|
||||
"manifest": "../serialization-evidence/sources.json",
|
||||
"file": "src/renderer/extensions/vueNodes/widgets/composables/useFloatWidget.ts",
|
||||
"lines": [
|
||||
[
|
||||
12,
|
||||
27
|
||||
],
|
||||
[
|
||||
59,
|
||||
85
|
||||
]
|
||||
],
|
||||
"purpose": "constructor UI defaults and callback; no save-time callback"
|
||||
},
|
||||
{
|
||||
"manifest": "../serialization-evidence/sources.json",
|
||||
"file": "src/utils/executionUtil.ts",
|
||||
"lines": [
|
||||
[
|
||||
85,
|
||||
104
|
||||
]
|
||||
],
|
||||
"purpose": "graphToPrompt tests options.serialize, then serializeValue or value"
|
||||
},
|
||||
{
|
||||
"manifest": "../structure-reference/sources.json",
|
||||
"file": "src/extensions/core/uploadAudio.ts",
|
||||
"lines": [
|
||||
[
|
||||
76,
|
||||
110
|
||||
],
|
||||
[
|
||||
116,
|
||||
138
|
||||
],
|
||||
[
|
||||
161,
|
||||
259
|
||||
]
|
||||
],
|
||||
"purpose": "register nodes audioUI and load upload; two different serialize markers"
|
||||
},
|
||||
{
|
||||
"manifest": "../structure-reference/sources.json",
|
||||
"file": "src/scripts/domWidget.ts",
|
||||
"lines": [
|
||||
[
|
||||
142,
|
||||
148
|
||||
]
|
||||
],
|
||||
"purpose": "getter empty string when getValue absent"
|
||||
}
|
||||
],
|
||||
"fail_closed": [
|
||||
"wrong provider or missing/conflicting node version",
|
||||
"unsupported frontend version",
|
||||
"missing/extra widgets or named overrides",
|
||||
"wrong scalar type/bool-as-number/nonfinite/outside frontend range",
|
||||
"unknown enum/dynamic prefix",
|
||||
"duplicate/missing/extra/reordered sockets, changed widget binding",
|
||||
"bad links, type/slot/reciprocal records, muted/bypass or unknown nodes",
|
||||
"nonempty UE link/connectability overrides or custom serializer"
|
||||
],
|
||||
"unknowns": [
|
||||
"source frontend version; explicit selected reference not source claim",
|
||||
"UE7.4.1/7.5.2 behavior and actual modifications",
|
||||
"registry commit binding/license at1.4.0",
|
||||
"mixed core versions installed together",
|
||||
"target core/plugin/frontend versions",
|
||||
"input file availability/decoding; node package/model weights existence",
|
||||
"real history, encoding, quality/effect/performance",
|
||||
"no supplied true API: comparison_unavailable"
|
||||
],
|
||||
"execution_verified": false,
|
||||
"production_state_changed": false
|
||||
}
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,614 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import av
|
||||
import torchaudio
|
||||
import torch
|
||||
import comfy.model_management
|
||||
import folder_paths
|
||||
import os
|
||||
import io
|
||||
import json
|
||||
import random
|
||||
import hashlib
|
||||
import node_helpers
|
||||
import logging
|
||||
from comfy.cli_args import args
|
||||
from comfy.comfy_types import FileLocator
|
||||
|
||||
class EmptyLatentAudio:
|
||||
def __init__(self):
|
||||
self.device = comfy.model_management.intermediate_device()
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"seconds": ("FLOAT", {"default": 47.6, "min": 1.0, "max": 1000.0, "step": 0.1}),
|
||||
"batch_size": ("INT", {"default": 1, "min": 1, "max": 4096, "tooltip": "The number of latent images in the batch."}),
|
||||
}}
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
FUNCTION = "generate"
|
||||
|
||||
CATEGORY = "latent/audio"
|
||||
|
||||
def generate(self, seconds, batch_size):
|
||||
length = round((seconds * 44100 / 2048) / 2) * 2
|
||||
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):
|
||||
return {"required": { "audio": ("AUDIO", ), "vae": ("VAE", )}}
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
FUNCTION = "encode"
|
||||
|
||||
CATEGORY = "latent/audio"
|
||||
|
||||
def encode(self, vae, audio):
|
||||
sample_rate = audio["sample_rate"]
|
||||
if 44100 != sample_rate:
|
||||
waveform = torchaudio.functional.resample(audio["waveform"], sample_rate, 44100)
|
||||
else:
|
||||
waveform = audio["waveform"]
|
||||
|
||||
t = vae.encode(waveform.movedim(1, -1))
|
||||
return ({"samples":t}, )
|
||||
|
||||
class VAEDecodeAudio:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "samples": ("LATENT", ), "vae": ("VAE", )}}
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
FUNCTION = "decode"
|
||||
|
||||
CATEGORY = "latent/audio"
|
||||
|
||||
def decode(self, vae, samples):
|
||||
audio = vae.decode(samples["samples"]).movedim(-1, 1)
|
||||
std = torch.std(audio, dim=[1,2], keepdim=True) * 5.0
|
||||
std[std < 1.0] = 1.0
|
||||
audio /= std
|
||||
return ({"waveform": audio, "sample_rate": 44100}, )
|
||||
|
||||
|
||||
def save_audio(self, audio, filename_prefix="ComfyUI", format="flac", prompt=None, extra_pnginfo=None, quality="128k"):
|
||||
|
||||
filename_prefix += self.prefix_append
|
||||
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir)
|
||||
results: list[FileLocator] = []
|
||||
|
||||
# Prepare metadata dictionary
|
||||
metadata = {}
|
||||
if not args.disable_metadata:
|
||||
if prompt is not None:
|
||||
metadata["prompt"] = json.dumps(prompt)
|
||||
if extra_pnginfo is not None:
|
||||
for x in extra_pnginfo:
|
||||
metadata[x] = json.dumps(extra_pnginfo[x])
|
||||
|
||||
# Opus supported sample rates
|
||||
OPUS_RATES = [8000, 12000, 16000, 24000, 48000]
|
||||
|
||||
for (batch_number, waveform) in enumerate(audio["waveform"].cpu()):
|
||||
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
||||
file = f"{filename_with_batch_num}_{counter:05}_.{format}"
|
||||
output_path = os.path.join(full_output_folder, file)
|
||||
|
||||
# Use original sample rate initially
|
||||
sample_rate = audio["sample_rate"]
|
||||
|
||||
# Handle Opus sample rate requirements
|
||||
if format == "opus":
|
||||
if sample_rate > 48000:
|
||||
sample_rate = 48000
|
||||
elif sample_rate not in OPUS_RATES:
|
||||
# Find the next highest supported rate
|
||||
for rate in sorted(OPUS_RATES):
|
||||
if rate > sample_rate:
|
||||
sample_rate = rate
|
||||
break
|
||||
if sample_rate not in OPUS_RATES: # Fallback if still not supported
|
||||
sample_rate = 48000
|
||||
|
||||
# Resample if necessary
|
||||
if sample_rate != audio["sample_rate"]:
|
||||
waveform = torchaudio.functional.resample(waveform, audio["sample_rate"], sample_rate)
|
||||
|
||||
# Create output with specified format
|
||||
output_buffer = io.BytesIO()
|
||||
output_container = av.open(output_buffer, mode='w', format=format)
|
||||
|
||||
# Set metadata on the container
|
||||
for key, value in metadata.items():
|
||||
output_container.metadata[key] = value
|
||||
|
||||
layout = 'mono' if waveform.shape[0] == 1 else 'stereo'
|
||||
# Set up the output stream with appropriate properties
|
||||
if format == "opus":
|
||||
out_stream = output_container.add_stream("libopus", rate=sample_rate, layout=layout)
|
||||
if quality == "64k":
|
||||
out_stream.bit_rate = 64000
|
||||
elif quality == "96k":
|
||||
out_stream.bit_rate = 96000
|
||||
elif quality == "128k":
|
||||
out_stream.bit_rate = 128000
|
||||
elif quality == "192k":
|
||||
out_stream.bit_rate = 192000
|
||||
elif quality == "320k":
|
||||
out_stream.bit_rate = 320000
|
||||
elif format == "mp3":
|
||||
out_stream = output_container.add_stream("libmp3lame", rate=sample_rate, layout=layout)
|
||||
if quality == "V0":
|
||||
#TODO i would really love to support V3 and V5 but there doesn't seem to be a way to set the qscale level, the property below is a bool
|
||||
out_stream.codec_context.qscale = 1
|
||||
elif quality == "128k":
|
||||
out_stream.bit_rate = 128000
|
||||
elif quality == "320k":
|
||||
out_stream.bit_rate = 320000
|
||||
else: #format == "flac":
|
||||
out_stream = output_container.add_stream("flac", rate=sample_rate, layout=layout)
|
||||
|
||||
frame = av.AudioFrame.from_ndarray(waveform.movedim(0, 1).reshape(1, -1).float().numpy(), format='flt', layout=layout)
|
||||
frame.sample_rate = sample_rate
|
||||
frame.pts = 0
|
||||
output_container.mux(out_stream.encode(frame))
|
||||
|
||||
# Flush encoder
|
||||
output_container.mux(out_stream.encode(None))
|
||||
|
||||
# Close containers
|
||||
output_container.close()
|
||||
|
||||
# Write the output to file
|
||||
output_buffer.seek(0)
|
||||
with open(output_path, 'wb') as f:
|
||||
f.write(output_buffer.getbuffer())
|
||||
|
||||
results.append({
|
||||
"filename": file,
|
||||
"subfolder": subfolder,
|
||||
"type": self.type
|
||||
})
|
||||
counter += 1
|
||||
|
||||
return { "ui": { "audio": results } }
|
||||
|
||||
class SaveAudio:
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_output_directory()
|
||||
self.type = "output"
|
||||
self.prefix_append = ""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "audio": ("AUDIO", ),
|
||||
"filename_prefix": ("STRING", {"default": "audio/ComfyUI"}),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "save_flac"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
def save_flac(self, audio, filename_prefix="ComfyUI", format="flac", prompt=None, extra_pnginfo=None):
|
||||
return save_audio(self, audio, filename_prefix, format, prompt, extra_pnginfo)
|
||||
|
||||
class SaveAudioMP3:
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_output_directory()
|
||||
self.type = "output"
|
||||
self.prefix_append = ""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "audio": ("AUDIO", ),
|
||||
"filename_prefix": ("STRING", {"default": "audio/ComfyUI"}),
|
||||
"quality": (["V0", "128k", "320k"], {"default": "V0"}),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "save_mp3"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
def save_mp3(self, audio, filename_prefix="ComfyUI", format="mp3", prompt=None, extra_pnginfo=None, quality="128k"):
|
||||
return save_audio(self, audio, filename_prefix, format, prompt, extra_pnginfo, quality)
|
||||
|
||||
class SaveAudioOpus:
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_output_directory()
|
||||
self.type = "output"
|
||||
self.prefix_append = ""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "audio": ("AUDIO", ),
|
||||
"filename_prefix": ("STRING", {"default": "audio/ComfyUI"}),
|
||||
"quality": (["64k", "96k", "128k", "192k", "320k"], {"default": "128k"}),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "save_opus"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
def save_opus(self, audio, filename_prefix="ComfyUI", format="opus", prompt=None, extra_pnginfo=None, quality="V3"):
|
||||
return save_audio(self, audio, filename_prefix, format, prompt, extra_pnginfo, quality)
|
||||
|
||||
class PreviewAudio(SaveAudio):
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_temp_directory()
|
||||
self.type = "temp"
|
||||
self.prefix_append = "_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5))
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required":
|
||||
{"audio": ("AUDIO", ), },
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
def f32_pcm(wav: torch.Tensor) -> torch.Tensor:
|
||||
"""Convert audio to float 32 bits PCM format."""
|
||||
if wav.dtype.is_floating_point:
|
||||
return wav
|
||||
elif wav.dtype == torch.int16:
|
||||
return wav.float() / (2 ** 15)
|
||||
elif wav.dtype == torch.int32:
|
||||
return wav.float() / (2 ** 31)
|
||||
raise ValueError(f"Unsupported wav dtype: {wav.dtype}")
|
||||
|
||||
def load(filepath: str) -> tuple[torch.Tensor, int]:
|
||||
with av.open(filepath) as af:
|
||||
if not af.streams.audio:
|
||||
raise ValueError("No audio stream found in the file.")
|
||||
|
||||
stream = af.streams.audio[0]
|
||||
sr = stream.codec_context.sample_rate
|
||||
n_channels = stream.channels
|
||||
|
||||
frames = []
|
||||
length = 0
|
||||
for frame in af.decode(streams=stream.index):
|
||||
buf = torch.from_numpy(frame.to_ndarray())
|
||||
if buf.shape[0] != n_channels:
|
||||
buf = buf.view(-1, n_channels).t()
|
||||
|
||||
frames.append(buf)
|
||||
length += buf.shape[1]
|
||||
|
||||
if not frames:
|
||||
raise ValueError("No audio frames decoded.")
|
||||
|
||||
wav = torch.cat(frames, dim=1)
|
||||
wav = f32_pcm(wav)
|
||||
return wav, sr
|
||||
|
||||
class LoadAudio:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
input_dir = folder_paths.get_input_directory()
|
||||
files = folder_paths.filter_files_content_types(os.listdir(input_dir), ["audio", "video"])
|
||||
return {"required": {"audio": (sorted(files), {"audio_upload": True})}}
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
RETURN_TYPES = ("AUDIO", )
|
||||
FUNCTION = "load"
|
||||
|
||||
def load(self, audio):
|
||||
audio_path = folder_paths.get_annotated_filepath(audio)
|
||||
waveform, sample_rate = load(audio_path)
|
||||
audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
|
||||
return (audio, )
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(s, audio):
|
||||
image_path = folder_paths.get_annotated_filepath(audio)
|
||||
m = hashlib.sha256()
|
||||
with open(image_path, 'rb') as f:
|
||||
m.update(f.read())
|
||||
return m.digest().hex()
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, audio):
|
||||
if not folder_paths.exists_annotated_filepath(audio):
|
||||
return "Invalid audio file: {}".format(audio)
|
||||
return True
|
||||
|
||||
class RecordAudio:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"audio": ("AUDIO_RECORD", {})}}
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
RETURN_TYPES = ("AUDIO", )
|
||||
FUNCTION = "load"
|
||||
|
||||
def load(self, audio):
|
||||
audio_path = folder_paths.get_annotated_filepath(audio)
|
||||
|
||||
waveform, sample_rate = load(audio_path)
|
||||
audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
|
||||
return (audio, )
|
||||
|
||||
|
||||
class TrimAudioDuration:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"audio": ("AUDIO",),
|
||||
"start_index": ("FLOAT", {"default": 0.0, "min": -0xffffffffffffffff, "max": 0xffffffffffffffff, "step": 0.01, "tooltip": "Start time in seconds, can be negative to count from the end (supports sub-seconds)."}),
|
||||
"duration": ("FLOAT", {"default": 60.0, "min": 0.0, "step": 0.01, "tooltip": "Duration in seconds"}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "trim"
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Trim audio tensor into chosen time range."
|
||||
|
||||
def trim(self, audio, start_index, duration):
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
audio_length = waveform.shape[-1]
|
||||
|
||||
if start_index < 0:
|
||||
start_frame = audio_length + int(round(start_index * sample_rate))
|
||||
else:
|
||||
start_frame = int(round(start_index * sample_rate))
|
||||
start_frame = max(0, min(start_frame, audio_length - 1))
|
||||
|
||||
end_frame = start_frame + int(round(duration * sample_rate))
|
||||
end_frame = max(0, min(end_frame, audio_length))
|
||||
|
||||
if start_frame >= end_frame:
|
||||
raise ValueError("AudioTrim: Start time must be less than end time and be within the audio length.")
|
||||
|
||||
return ({"waveform": waveform[..., start_frame:end_frame], "sample_rate": sample_rate},)
|
||||
|
||||
|
||||
class SplitAudioChannels:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"audio": ("AUDIO",),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("AUDIO", "AUDIO")
|
||||
RETURN_NAMES = ("left", "right")
|
||||
FUNCTION = "separate"
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Separates the audio into left and right channels."
|
||||
|
||||
def separate(self, audio):
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
|
||||
if waveform.shape[1] != 2:
|
||||
raise ValueError("AudioSplit: Input audio has only one channel.")
|
||||
|
||||
left_channel = waveform[..., 0:1, :]
|
||||
right_channel = waveform[..., 1:2, :]
|
||||
|
||||
return ({"waveform": left_channel, "sample_rate": sample_rate}, {"waveform": right_channel, "sample_rate": sample_rate})
|
||||
|
||||
|
||||
def match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2):
|
||||
if sample_rate_1 != sample_rate_2:
|
||||
if sample_rate_1 > sample_rate_2:
|
||||
waveform_2 = torchaudio.functional.resample(waveform_2, sample_rate_2, sample_rate_1)
|
||||
output_sample_rate = sample_rate_1
|
||||
logging.info(f"Resampling audio2 from {sample_rate_2}Hz to {sample_rate_1}Hz for merging.")
|
||||
else:
|
||||
waveform_1 = torchaudio.functional.resample(waveform_1, sample_rate_1, sample_rate_2)
|
||||
output_sample_rate = sample_rate_2
|
||||
logging.info(f"Resampling audio1 from {sample_rate_1}Hz to {sample_rate_2}Hz for merging.")
|
||||
else:
|
||||
output_sample_rate = sample_rate_1
|
||||
return waveform_1, waveform_2, output_sample_rate
|
||||
|
||||
|
||||
class AudioConcat:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"audio1": ("AUDIO",),
|
||||
"audio2": ("AUDIO",),
|
||||
"direction": (['after', 'before'], {"default": 'after', "tooltip": "Whether to append audio2 after or before audio1."}),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
FUNCTION = "concat"
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Concatenates the audio1 to audio2 in the specified direction."
|
||||
|
||||
def concat(self, audio1, audio2, direction):
|
||||
waveform_1 = audio1["waveform"]
|
||||
waveform_2 = audio2["waveform"]
|
||||
sample_rate_1 = audio1["sample_rate"]
|
||||
sample_rate_2 = audio2["sample_rate"]
|
||||
|
||||
if waveform_1.shape[1] == 1:
|
||||
waveform_1 = waveform_1.repeat(1, 2, 1)
|
||||
logging.info("AudioConcat: Converted mono audio1 to stereo by duplicating the channel.")
|
||||
if waveform_2.shape[1] == 1:
|
||||
waveform_2 = waveform_2.repeat(1, 2, 1)
|
||||
logging.info("AudioConcat: Converted mono audio2 to stereo by duplicating the channel.")
|
||||
|
||||
waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
|
||||
|
||||
if direction == 'after':
|
||||
concatenated_audio = torch.cat((waveform_1, waveform_2), dim=2)
|
||||
elif direction == 'before':
|
||||
concatenated_audio = torch.cat((waveform_2, waveform_1), dim=2)
|
||||
|
||||
return ({"waveform": concatenated_audio, "sample_rate": output_sample_rate},)
|
||||
|
||||
|
||||
class AudioMerge:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"audio1": ("AUDIO",),
|
||||
"audio2": ("AUDIO",),
|
||||
"merge_method": (["add", "mean", "subtract", "multiply"], {"tooltip": "The method used to combine the audio waveforms."}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "merge"
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Combine two audio tracks by overlaying their waveforms."
|
||||
|
||||
def merge(self, audio1, audio2, merge_method):
|
||||
waveform_1 = audio1["waveform"]
|
||||
waveform_2 = audio2["waveform"]
|
||||
sample_rate_1 = audio1["sample_rate"]
|
||||
sample_rate_2 = audio2["sample_rate"]
|
||||
|
||||
waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
|
||||
|
||||
length_1 = waveform_1.shape[-1]
|
||||
length_2 = waveform_2.shape[-1]
|
||||
|
||||
if length_2 > length_1:
|
||||
logging.info(f"AudioMerge: Trimming audio2 from {length_2} to {length_1} samples to match audio1 length.")
|
||||
waveform_2 = waveform_2[..., :length_1]
|
||||
elif length_2 < length_1:
|
||||
logging.info(f"AudioMerge: Padding audio2 from {length_2} to {length_1} samples to match audio1 length.")
|
||||
pad_shape = list(waveform_2.shape)
|
||||
pad_shape[-1] = length_1 - length_2
|
||||
pad_tensor = torch.zeros(pad_shape, dtype=waveform_2.dtype, device=waveform_2.device)
|
||||
waveform_2 = torch.cat((waveform_2, pad_tensor), dim=-1)
|
||||
|
||||
if merge_method == "add":
|
||||
waveform = waveform_1 + waveform_2
|
||||
elif merge_method == "subtract":
|
||||
waveform = waveform_1 - waveform_2
|
||||
elif merge_method == "multiply":
|
||||
waveform = waveform_1 * waveform_2
|
||||
elif merge_method == "mean":
|
||||
waveform = (waveform_1 + waveform_2) / 2
|
||||
|
||||
max_val = waveform.abs().max()
|
||||
if max_val > 1.0:
|
||||
waveform = waveform / max_val
|
||||
|
||||
return ({"waveform": waveform, "sample_rate": output_sample_rate},)
|
||||
|
||||
|
||||
class AudioAdjustVolume:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"audio": ("AUDIO",),
|
||||
"volume": ("INT", {"default": 1.0, "min": -100, "max": 100, "tooltip": "Volume adjustment in decibels (dB). 0 = no change, +6 = double, -6 = half, etc"}),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
FUNCTION = "adjust_volume"
|
||||
CATEGORY = "audio"
|
||||
|
||||
def adjust_volume(self, audio, volume):
|
||||
if volume == 0:
|
||||
return (audio,)
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
|
||||
gain = 10 ** (volume / 20)
|
||||
waveform = waveform * gain
|
||||
|
||||
return ({"waveform": waveform, "sample_rate": sample_rate},)
|
||||
|
||||
|
||||
class EmptyAudio:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"duration": ("FLOAT", {"default": 60.0, "min": 0.0, "max": 0xffffffffffffffff, "step": 0.01, "tooltip": "Duration of the empty audio clip in seconds"}),
|
||||
"sample_rate": ("INT", {"default": 44100, "tooltip": "Sample rate of the empty audio clip."}),
|
||||
"channels": ("INT", {"default": 2, "min": 1, "max": 2, "tooltip": "Number of audio channels (1 for mono, 2 for stereo)."}),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
FUNCTION = "create_empty_audio"
|
||||
CATEGORY = "audio"
|
||||
|
||||
def create_empty_audio(self, duration, sample_rate, channels):
|
||||
num_samples = int(round(duration * sample_rate))
|
||||
waveform = torch.zeros((1, channels, num_samples), dtype=torch.float32)
|
||||
return ({"waveform": waveform, "sample_rate": sample_rate},)
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"EmptyLatentAudio": EmptyLatentAudio,
|
||||
"VAEEncodeAudio": VAEEncodeAudio,
|
||||
"VAEDecodeAudio": VAEDecodeAudio,
|
||||
"SaveAudio": SaveAudio,
|
||||
"SaveAudioMP3": SaveAudioMP3,
|
||||
"SaveAudioOpus": SaveAudioOpus,
|
||||
"LoadAudio": LoadAudio,
|
||||
"PreviewAudio": PreviewAudio,
|
||||
"ConditioningStableAudio": ConditioningStableAudio,
|
||||
"RecordAudio": RecordAudio,
|
||||
"TrimAudioDuration": TrimAudioDuration,
|
||||
"SplitAudioChannels": SplitAudioChannels,
|
||||
"AudioConcat": AudioConcat,
|
||||
"AudioMerge": AudioMerge,
|
||||
"AudioAdjustVolume": AudioAdjustVolume,
|
||||
"EmptyAudio": EmptyAudio,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"EmptyLatentAudio": "Empty Latent Audio",
|
||||
"VAEEncodeAudio": "VAE Encode Audio",
|
||||
"VAEDecodeAudio": "VAE Decode Audio",
|
||||
"PreviewAudio": "Preview Audio",
|
||||
"LoadAudio": "Load Audio",
|
||||
"SaveAudio": "Save Audio (FLAC)",
|
||||
"SaveAudioMP3": "Save Audio (MP3)",
|
||||
"SaveAudioOpus": "Save Audio (Opus)",
|
||||
"RecordAudio": "Record Audio",
|
||||
"TrimAudioDuration": "Trim Audio Duration",
|
||||
"SplitAudioChannels": "Split Audio Channels",
|
||||
"AudioConcat": "Audio Concat",
|
||||
"AudioMerge": "Audio Merge",
|
||||
"AudioAdjustVolume": "Audio Adjust Volume",
|
||||
"EmptyAudio": "Empty Audio",
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,614 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import av
|
||||
import torchaudio
|
||||
import torch
|
||||
import comfy.model_management
|
||||
import folder_paths
|
||||
import os
|
||||
import io
|
||||
import json
|
||||
import random
|
||||
import hashlib
|
||||
import node_helpers
|
||||
import logging
|
||||
from comfy.cli_args import args
|
||||
from comfy.comfy_types import FileLocator
|
||||
|
||||
class EmptyLatentAudio:
|
||||
def __init__(self):
|
||||
self.device = comfy.model_management.intermediate_device()
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"seconds": ("FLOAT", {"default": 47.6, "min": 1.0, "max": 1000.0, "step": 0.1}),
|
||||
"batch_size": ("INT", {"default": 1, "min": 1, "max": 4096, "tooltip": "The number of latent images in the batch."}),
|
||||
}}
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
FUNCTION = "generate"
|
||||
|
||||
CATEGORY = "latent/audio"
|
||||
|
||||
def generate(self, seconds, batch_size):
|
||||
length = round((seconds * 44100 / 2048) / 2) * 2
|
||||
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):
|
||||
return {"required": { "audio": ("AUDIO", ), "vae": ("VAE", )}}
|
||||
RETURN_TYPES = ("LATENT",)
|
||||
FUNCTION = "encode"
|
||||
|
||||
CATEGORY = "latent/audio"
|
||||
|
||||
def encode(self, vae, audio):
|
||||
sample_rate = audio["sample_rate"]
|
||||
if 44100 != sample_rate:
|
||||
waveform = torchaudio.functional.resample(audio["waveform"], sample_rate, 44100)
|
||||
else:
|
||||
waveform = audio["waveform"]
|
||||
|
||||
t = vae.encode(waveform.movedim(1, -1))
|
||||
return ({"samples":t}, )
|
||||
|
||||
class VAEDecodeAudio:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "samples": ("LATENT", ), "vae": ("VAE", )}}
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
FUNCTION = "decode"
|
||||
|
||||
CATEGORY = "latent/audio"
|
||||
|
||||
def decode(self, vae, samples):
|
||||
audio = vae.decode(samples["samples"]).movedim(-1, 1)
|
||||
std = torch.std(audio, dim=[1,2], keepdim=True) * 5.0
|
||||
std[std < 1.0] = 1.0
|
||||
audio /= std
|
||||
return ({"waveform": audio, "sample_rate": 44100}, )
|
||||
|
||||
|
||||
def save_audio(self, audio, filename_prefix="ComfyUI", format="flac", prompt=None, extra_pnginfo=None, quality="128k"):
|
||||
|
||||
filename_prefix += self.prefix_append
|
||||
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir)
|
||||
results: list[FileLocator] = []
|
||||
|
||||
# Prepare metadata dictionary
|
||||
metadata = {}
|
||||
if not args.disable_metadata:
|
||||
if prompt is not None:
|
||||
metadata["prompt"] = json.dumps(prompt)
|
||||
if extra_pnginfo is not None:
|
||||
for x in extra_pnginfo:
|
||||
metadata[x] = json.dumps(extra_pnginfo[x])
|
||||
|
||||
# Opus supported sample rates
|
||||
OPUS_RATES = [8000, 12000, 16000, 24000, 48000]
|
||||
|
||||
for (batch_number, waveform) in enumerate(audio["waveform"].cpu()):
|
||||
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
||||
file = f"{filename_with_batch_num}_{counter:05}_.{format}"
|
||||
output_path = os.path.join(full_output_folder, file)
|
||||
|
||||
# Use original sample rate initially
|
||||
sample_rate = audio["sample_rate"]
|
||||
|
||||
# Handle Opus sample rate requirements
|
||||
if format == "opus":
|
||||
if sample_rate > 48000:
|
||||
sample_rate = 48000
|
||||
elif sample_rate not in OPUS_RATES:
|
||||
# Find the next highest supported rate
|
||||
for rate in sorted(OPUS_RATES):
|
||||
if rate > sample_rate:
|
||||
sample_rate = rate
|
||||
break
|
||||
if sample_rate not in OPUS_RATES: # Fallback if still not supported
|
||||
sample_rate = 48000
|
||||
|
||||
# Resample if necessary
|
||||
if sample_rate != audio["sample_rate"]:
|
||||
waveform = torchaudio.functional.resample(waveform, audio["sample_rate"], sample_rate)
|
||||
|
||||
# Create output with specified format
|
||||
output_buffer = io.BytesIO()
|
||||
output_container = av.open(output_buffer, mode='w', format=format)
|
||||
|
||||
# Set metadata on the container
|
||||
for key, value in metadata.items():
|
||||
output_container.metadata[key] = value
|
||||
|
||||
layout = 'mono' if waveform.shape[0] == 1 else 'stereo'
|
||||
# Set up the output stream with appropriate properties
|
||||
if format == "opus":
|
||||
out_stream = output_container.add_stream("libopus", rate=sample_rate, layout=layout)
|
||||
if quality == "64k":
|
||||
out_stream.bit_rate = 64000
|
||||
elif quality == "96k":
|
||||
out_stream.bit_rate = 96000
|
||||
elif quality == "128k":
|
||||
out_stream.bit_rate = 128000
|
||||
elif quality == "192k":
|
||||
out_stream.bit_rate = 192000
|
||||
elif quality == "320k":
|
||||
out_stream.bit_rate = 320000
|
||||
elif format == "mp3":
|
||||
out_stream = output_container.add_stream("libmp3lame", rate=sample_rate, layout=layout)
|
||||
if quality == "V0":
|
||||
#TODO i would really love to support V3 and V5 but there doesn't seem to be a way to set the qscale level, the property below is a bool
|
||||
out_stream.codec_context.qscale = 1
|
||||
elif quality == "128k":
|
||||
out_stream.bit_rate = 128000
|
||||
elif quality == "320k":
|
||||
out_stream.bit_rate = 320000
|
||||
else: #format == "flac":
|
||||
out_stream = output_container.add_stream("flac", rate=sample_rate, layout=layout)
|
||||
|
||||
frame = av.AudioFrame.from_ndarray(waveform.movedim(0, 1).reshape(1, -1).float().numpy(), format='flt', layout=layout)
|
||||
frame.sample_rate = sample_rate
|
||||
frame.pts = 0
|
||||
output_container.mux(out_stream.encode(frame))
|
||||
|
||||
# Flush encoder
|
||||
output_container.mux(out_stream.encode(None))
|
||||
|
||||
# Close containers
|
||||
output_container.close()
|
||||
|
||||
# Write the output to file
|
||||
output_buffer.seek(0)
|
||||
with open(output_path, 'wb') as f:
|
||||
f.write(output_buffer.getbuffer())
|
||||
|
||||
results.append({
|
||||
"filename": file,
|
||||
"subfolder": subfolder,
|
||||
"type": self.type
|
||||
})
|
||||
counter += 1
|
||||
|
||||
return { "ui": { "audio": results } }
|
||||
|
||||
class SaveAudio:
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_output_directory()
|
||||
self.type = "output"
|
||||
self.prefix_append = ""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "audio": ("AUDIO", ),
|
||||
"filename_prefix": ("STRING", {"default": "audio/ComfyUI"}),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "save_flac"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
def save_flac(self, audio, filename_prefix="ComfyUI", format="flac", prompt=None, extra_pnginfo=None):
|
||||
return save_audio(self, audio, filename_prefix, format, prompt, extra_pnginfo)
|
||||
|
||||
class SaveAudioMP3:
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_output_directory()
|
||||
self.type = "output"
|
||||
self.prefix_append = ""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "audio": ("AUDIO", ),
|
||||
"filename_prefix": ("STRING", {"default": "audio/ComfyUI"}),
|
||||
"quality": (["V0", "128k", "320k"], {"default": "V0"}),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "save_mp3"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
def save_mp3(self, audio, filename_prefix="ComfyUI", format="mp3", prompt=None, extra_pnginfo=None, quality="128k"):
|
||||
return save_audio(self, audio, filename_prefix, format, prompt, extra_pnginfo, quality)
|
||||
|
||||
class SaveAudioOpus:
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_output_directory()
|
||||
self.type = "output"
|
||||
self.prefix_append = ""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": { "audio": ("AUDIO", ),
|
||||
"filename_prefix": ("STRING", {"default": "audio/ComfyUI"}),
|
||||
"quality": (["64k", "96k", "128k", "192k", "320k"], {"default": "128k"}),
|
||||
},
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ()
|
||||
FUNCTION = "save_opus"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
def save_opus(self, audio, filename_prefix="ComfyUI", format="opus", prompt=None, extra_pnginfo=None, quality="V3"):
|
||||
return save_audio(self, audio, filename_prefix, format, prompt, extra_pnginfo, quality)
|
||||
|
||||
class PreviewAudio(SaveAudio):
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_temp_directory()
|
||||
self.type = "temp"
|
||||
self.prefix_append = "_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5))
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required":
|
||||
{"audio": ("AUDIO", ), },
|
||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||
}
|
||||
|
||||
def f32_pcm(wav: torch.Tensor) -> torch.Tensor:
|
||||
"""Convert audio to float 32 bits PCM format."""
|
||||
if wav.dtype.is_floating_point:
|
||||
return wav
|
||||
elif wav.dtype == torch.int16:
|
||||
return wav.float() / (2 ** 15)
|
||||
elif wav.dtype == torch.int32:
|
||||
return wav.float() / (2 ** 31)
|
||||
raise ValueError(f"Unsupported wav dtype: {wav.dtype}")
|
||||
|
||||
def load(filepath: str) -> tuple[torch.Tensor, int]:
|
||||
with av.open(filepath) as af:
|
||||
if not af.streams.audio:
|
||||
raise ValueError("No audio stream found in the file.")
|
||||
|
||||
stream = af.streams.audio[0]
|
||||
sr = stream.codec_context.sample_rate
|
||||
n_channels = stream.channels
|
||||
|
||||
frames = []
|
||||
length = 0
|
||||
for frame in af.decode(streams=stream.index):
|
||||
buf = torch.from_numpy(frame.to_ndarray())
|
||||
if buf.shape[0] != n_channels:
|
||||
buf = buf.view(-1, n_channels).t()
|
||||
|
||||
frames.append(buf)
|
||||
length += buf.shape[1]
|
||||
|
||||
if not frames:
|
||||
raise ValueError("No audio frames decoded.")
|
||||
|
||||
wav = torch.cat(frames, dim=1)
|
||||
wav = f32_pcm(wav)
|
||||
return wav, sr
|
||||
|
||||
class LoadAudio:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
input_dir = folder_paths.get_input_directory()
|
||||
files = folder_paths.filter_files_content_types(os.listdir(input_dir), ["audio", "video"])
|
||||
return {"required": {"audio": (sorted(files), {"audio_upload": True})}}
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
RETURN_TYPES = ("AUDIO", )
|
||||
FUNCTION = "load"
|
||||
|
||||
def load(self, audio):
|
||||
audio_path = folder_paths.get_annotated_filepath(audio)
|
||||
waveform, sample_rate = load(audio_path)
|
||||
audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
|
||||
return (audio, )
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(s, audio):
|
||||
image_path = folder_paths.get_annotated_filepath(audio)
|
||||
m = hashlib.sha256()
|
||||
with open(image_path, 'rb') as f:
|
||||
m.update(f.read())
|
||||
return m.digest().hex()
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, audio):
|
||||
if not folder_paths.exists_annotated_filepath(audio):
|
||||
return "Invalid audio file: {}".format(audio)
|
||||
return True
|
||||
|
||||
class RecordAudio:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {"audio": ("AUDIO_RECORD", {})}}
|
||||
|
||||
CATEGORY = "audio"
|
||||
|
||||
RETURN_TYPES = ("AUDIO", )
|
||||
FUNCTION = "load"
|
||||
|
||||
def load(self, audio):
|
||||
audio_path = folder_paths.get_annotated_filepath(audio)
|
||||
|
||||
waveform, sample_rate = load(audio_path)
|
||||
audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
|
||||
return (audio, )
|
||||
|
||||
|
||||
class TrimAudioDuration:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"audio": ("AUDIO",),
|
||||
"start_index": ("FLOAT", {"default": 0.0, "min": -0xffffffffffffffff, "max": 0xffffffffffffffff, "step": 0.01, "tooltip": "Start time in seconds, can be negative to count from the end (supports sub-seconds)."}),
|
||||
"duration": ("FLOAT", {"default": 60.0, "min": 0.0, "step": 0.01, "tooltip": "Duration in seconds"}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "trim"
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Trim audio tensor into chosen time range."
|
||||
|
||||
def trim(self, audio, start_index, duration):
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
audio_length = waveform.shape[-1]
|
||||
|
||||
if start_index < 0:
|
||||
start_frame = audio_length + int(round(start_index * sample_rate))
|
||||
else:
|
||||
start_frame = int(round(start_index * sample_rate))
|
||||
start_frame = max(0, min(start_frame, audio_length - 1))
|
||||
|
||||
end_frame = start_frame + int(round(duration * sample_rate))
|
||||
end_frame = max(0, min(end_frame, audio_length))
|
||||
|
||||
if start_frame >= end_frame:
|
||||
raise ValueError("AudioTrim: Start time must be less than end time and be within the audio length.")
|
||||
|
||||
return ({"waveform": waveform[..., start_frame:end_frame], "sample_rate": sample_rate},)
|
||||
|
||||
|
||||
class SplitAudioChannels:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"audio": ("AUDIO",),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("AUDIO", "AUDIO")
|
||||
RETURN_NAMES = ("left", "right")
|
||||
FUNCTION = "separate"
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Separates the audio into left and right channels."
|
||||
|
||||
def separate(self, audio):
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
|
||||
if waveform.shape[1] != 2:
|
||||
raise ValueError("AudioSplit: Input audio has only one channel.")
|
||||
|
||||
left_channel = waveform[..., 0:1, :]
|
||||
right_channel = waveform[..., 1:2, :]
|
||||
|
||||
return ({"waveform": left_channel, "sample_rate": sample_rate}, {"waveform": right_channel, "sample_rate": sample_rate})
|
||||
|
||||
|
||||
def match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2):
|
||||
if sample_rate_1 != sample_rate_2:
|
||||
if sample_rate_1 > sample_rate_2:
|
||||
waveform_2 = torchaudio.functional.resample(waveform_2, sample_rate_2, sample_rate_1)
|
||||
output_sample_rate = sample_rate_1
|
||||
logging.info(f"Resampling audio2 from {sample_rate_2}Hz to {sample_rate_1}Hz for merging.")
|
||||
else:
|
||||
waveform_1 = torchaudio.functional.resample(waveform_1, sample_rate_1, sample_rate_2)
|
||||
output_sample_rate = sample_rate_2
|
||||
logging.info(f"Resampling audio1 from {sample_rate_1}Hz to {sample_rate_2}Hz for merging.")
|
||||
else:
|
||||
output_sample_rate = sample_rate_1
|
||||
return waveform_1, waveform_2, output_sample_rate
|
||||
|
||||
|
||||
class AudioConcat:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"audio1": ("AUDIO",),
|
||||
"audio2": ("AUDIO",),
|
||||
"direction": (['after', 'before'], {"default": 'after', "tooltip": "Whether to append audio2 after or before audio1."}),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
FUNCTION = "concat"
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Concatenates the audio1 to audio2 in the specified direction."
|
||||
|
||||
def concat(self, audio1, audio2, direction):
|
||||
waveform_1 = audio1["waveform"]
|
||||
waveform_2 = audio2["waveform"]
|
||||
sample_rate_1 = audio1["sample_rate"]
|
||||
sample_rate_2 = audio2["sample_rate"]
|
||||
|
||||
if waveform_1.shape[1] == 1:
|
||||
waveform_1 = waveform_1.repeat(1, 2, 1)
|
||||
logging.info("AudioConcat: Converted mono audio1 to stereo by duplicating the channel.")
|
||||
if waveform_2.shape[1] == 1:
|
||||
waveform_2 = waveform_2.repeat(1, 2, 1)
|
||||
logging.info("AudioConcat: Converted mono audio2 to stereo by duplicating the channel.")
|
||||
|
||||
waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
|
||||
|
||||
if direction == 'after':
|
||||
concatenated_audio = torch.cat((waveform_1, waveform_2), dim=2)
|
||||
elif direction == 'before':
|
||||
concatenated_audio = torch.cat((waveform_2, waveform_1), dim=2)
|
||||
|
||||
return ({"waveform": concatenated_audio, "sample_rate": output_sample_rate},)
|
||||
|
||||
|
||||
class AudioMerge:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"audio1": ("AUDIO",),
|
||||
"audio2": ("AUDIO",),
|
||||
"merge_method": (["add", "mean", "subtract", "multiply"], {"tooltip": "The method used to combine the audio waveforms."}),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "merge"
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Combine two audio tracks by overlaying their waveforms."
|
||||
|
||||
def merge(self, audio1, audio2, merge_method):
|
||||
waveform_1 = audio1["waveform"]
|
||||
waveform_2 = audio2["waveform"]
|
||||
sample_rate_1 = audio1["sample_rate"]
|
||||
sample_rate_2 = audio2["sample_rate"]
|
||||
|
||||
waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
|
||||
|
||||
length_1 = waveform_1.shape[-1]
|
||||
length_2 = waveform_2.shape[-1]
|
||||
|
||||
if length_2 > length_1:
|
||||
logging.info(f"AudioMerge: Trimming audio2 from {length_2} to {length_1} samples to match audio1 length.")
|
||||
waveform_2 = waveform_2[..., :length_1]
|
||||
elif length_2 < length_1:
|
||||
logging.info(f"AudioMerge: Padding audio2 from {length_2} to {length_1} samples to match audio1 length.")
|
||||
pad_shape = list(waveform_2.shape)
|
||||
pad_shape[-1] = length_1 - length_2
|
||||
pad_tensor = torch.zeros(pad_shape, dtype=waveform_2.dtype, device=waveform_2.device)
|
||||
waveform_2 = torch.cat((waveform_2, pad_tensor), dim=-1)
|
||||
|
||||
if merge_method == "add":
|
||||
waveform = waveform_1 + waveform_2
|
||||
elif merge_method == "subtract":
|
||||
waveform = waveform_1 - waveform_2
|
||||
elif merge_method == "multiply":
|
||||
waveform = waveform_1 * waveform_2
|
||||
elif merge_method == "mean":
|
||||
waveform = (waveform_1 + waveform_2) / 2
|
||||
|
||||
max_val = waveform.abs().max()
|
||||
if max_val > 1.0:
|
||||
waveform = waveform / max_val
|
||||
|
||||
return ({"waveform": waveform, "sample_rate": output_sample_rate},)
|
||||
|
||||
|
||||
class AudioAdjustVolume:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"audio": ("AUDIO",),
|
||||
"volume": ("INT", {"default": 1.0, "min": -100, "max": 100, "tooltip": "Volume adjustment in decibels (dB). 0 = no change, +6 = double, -6 = half, etc"}),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
FUNCTION = "adjust_volume"
|
||||
CATEGORY = "audio"
|
||||
|
||||
def adjust_volume(self, audio, volume):
|
||||
if volume == 0:
|
||||
return (audio,)
|
||||
waveform = audio["waveform"]
|
||||
sample_rate = audio["sample_rate"]
|
||||
|
||||
gain = 10 ** (volume / 20)
|
||||
waveform = waveform * gain
|
||||
|
||||
return ({"waveform": waveform, "sample_rate": sample_rate},)
|
||||
|
||||
|
||||
class EmptyAudio:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required": {
|
||||
"duration": ("FLOAT", {"default": 60.0, "min": 0.0, "max": 0xffffffffffffffff, "step": 0.01, "tooltip": "Duration of the empty audio clip in seconds"}),
|
||||
"sample_rate": ("INT", {"default": 44100, "tooltip": "Sample rate of the empty audio clip."}),
|
||||
"channels": ("INT", {"default": 2, "min": 1, "max": 2, "tooltip": "Number of audio channels (1 for mono, 2 for stereo)."}),
|
||||
}}
|
||||
|
||||
RETURN_TYPES = ("AUDIO",)
|
||||
FUNCTION = "create_empty_audio"
|
||||
CATEGORY = "audio"
|
||||
|
||||
def create_empty_audio(self, duration, sample_rate, channels):
|
||||
num_samples = int(round(duration * sample_rate))
|
||||
waveform = torch.zeros((1, channels, num_samples), dtype=torch.float32)
|
||||
return ({"waveform": waveform, "sample_rate": sample_rate},)
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"EmptyLatentAudio": EmptyLatentAudio,
|
||||
"VAEEncodeAudio": VAEEncodeAudio,
|
||||
"VAEDecodeAudio": VAEDecodeAudio,
|
||||
"SaveAudio": SaveAudio,
|
||||
"SaveAudioMP3": SaveAudioMP3,
|
||||
"SaveAudioOpus": SaveAudioOpus,
|
||||
"LoadAudio": LoadAudio,
|
||||
"PreviewAudio": PreviewAudio,
|
||||
"ConditioningStableAudio": ConditioningStableAudio,
|
||||
"RecordAudio": RecordAudio,
|
||||
"TrimAudioDuration": TrimAudioDuration,
|
||||
"SplitAudioChannels": SplitAudioChannels,
|
||||
"AudioConcat": AudioConcat,
|
||||
"AudioMerge": AudioMerge,
|
||||
"AudioAdjustVolume": AudioAdjustVolume,
|
||||
"EmptyAudio": EmptyAudio,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"EmptyLatentAudio": "Empty Latent Audio",
|
||||
"VAEEncodeAudio": "VAE Encode Audio",
|
||||
"VAEDecodeAudio": "VAE Decode Audio",
|
||||
"PreviewAudio": "Preview Audio",
|
||||
"LoadAudio": "Load Audio",
|
||||
"SaveAudio": "Save Audio (FLAC)",
|
||||
"SaveAudioMP3": "Save Audio (MP3)",
|
||||
"SaveAudioOpus": "Save Audio (Opus)",
|
||||
"RecordAudio": "Record Audio",
|
||||
"TrimAudioDuration": "Trim Audio Duration",
|
||||
"SplitAudioChannels": "Split Audio Channels",
|
||||
"AudioConcat": "Audio Concat",
|
||||
"AudioMerge": "Audio Merge",
|
||||
"AudioAdjustVolume": "Audio Adjust Volume",
|
||||
"EmptyAudio": "Empty Audio",
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"ref":"refs/tags/v0.3.68","node_id":"REF_kwDOIygeJrFyZWZzL3RhZ3MvdjAuMy42OA","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/refs/tags/v0.3.68","object":{"sha":"265adad858e1f31b66cd3523a02b16f5d34ced52","type":"commit","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/265adad858e1f31b66cd3523a02b16f5d34ced52"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"ref":"refs/tags/v0.3.71","node_id":"REF_kwDOIygeJrFyZWZzL3RhZ3MvdjAuMy43MQ","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/refs/tags/v0.3.71","object":{"sha":"c55fd7481626d8bee8044ea7512ea996d13a1b90","type":"commit","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/c55fd7481626d8bee8044ea7512ea996d13a1b90"}}
|
||||
@@ -0,0 +1,200 @@
|
||||
{
|
||||
"metadata_reads": {
|
||||
"core-tag-0.3.71.json": {
|
||||
"sha256": "3588681ee2c7b92b05b9767e690c6e802de2b1fa2de77fb00e31bdbaef319a1a",
|
||||
"retrieved_at": "2026-10-29T19:06:42.244329+00:00",
|
||||
"url": "https://api.github.com/repos/Comfy-Org/ComfyUI/git/ref/tags/v0.3.71"
|
||||
},
|
||||
"plugin-tags.json": {
|
||||
"sha256": "d0bdabdba74cf146507a160b6558f80bc88bf4a67800ccf53d45b0ba0dc7c935",
|
||||
"retrieved_at": "2026-10-29T19:06:45.152354+00:00",
|
||||
"url": "https://api.github.com/repos/christian-byrne/audio-separation-nodes-comfyui/tags"
|
||||
},
|
||||
"plugin-history.json": {
|
||||
"sha256": "b087b4b15e1b0360df6909ec56548287170cd0df2a2d90ad79a13aed84b69ebe",
|
||||
"retrieved_at": "2026-10-29T19:06:46.080362+00:00",
|
||||
"url": "https://api.github.com/repos/christian-byrne/audio-separation-nodes-comfyui/commits?path=pyproject.toml&per_page=100"
|
||||
},
|
||||
"plugin-1.4.0-commit.json": {
|
||||
"sha256": "5859409573569b8411e2a528cd1700119526f4d51699ab3978b88b39a5b83ed3",
|
||||
"retrieved_at": "2026-10-29T19:07:48.396794+00:00",
|
||||
"url": "https://api.github.com/repos/christian-byrne/audio-separation-nodes-comfyui/commits/5291831d7c321ab7a5192374482f9848dffee75b"
|
||||
},
|
||||
"plugin-1.4.0-tree.json": {
|
||||
"sha256": "f3f823d1c09c27eb837e297778530295dc88001ff565fdcf91cded7aec345e09",
|
||||
"retrieved_at": "2026-10-29T19:07:48.888796+00:00",
|
||||
"url": "https://api.github.com/repos/christian-byrne/audio-separation-nodes-comfyui/git/trees/5291831d7c321ab7a5192374482f9848dffee75b?recursive=1"
|
||||
},
|
||||
"core-tag-0.3.68.json": {
|
||||
"sha256": "742b174239fec657e2d22cc8b8ab7c106dff817dcc9c0839c83bfdabb2edae84",
|
||||
"retrieved_at": "2026-10-29T19:06:39.284304+00:00",
|
||||
"url": "https://api.github.com/repos/Comfy-Org/ComfyUI/git/ref/tags/v0.3.68"
|
||||
},
|
||||
"registry-1.4.0.json": {
|
||||
"sha256": "fc57451975c27edad1799dab5f22178516425f6dfdf2ffb9ba08f8c2c09eac8f",
|
||||
"retrieved_at": "2026-10-29T19:06:46.648367+00:00",
|
||||
"url": "https://api.comfy.org/nodes/audio-separation-nodes-comfyui/versions/1.4.0"
|
||||
}
|
||||
},
|
||||
"search_bounds": "original repo tags (only v2.0.0), 17 pyproject commits in one page; sampled six historical pyprojects; chose 5291831d with 1.4.0, then checked registry API and package; no repeated missing-material requests",
|
||||
"registry_artifact": {
|
||||
"registry_metadata": {
|
||||
"sha256": "fc57451975c27edad1799dab5f22178516425f6dfdf2ffb9ba08f8c2c09eac8f",
|
||||
"retrieved_at": "2026-10-29T19:06:46.648367+00:00",
|
||||
"url": "https://api.comfy.org/nodes/audio-separation-nodes-comfyui/versions/1.4.0"
|
||||
},
|
||||
"download_url": "https://cdn.comfy.org/christian-byrne/audio-separation-nodes-comfyui/1.4.0/node.zip",
|
||||
"sha256": "0d39cf047e26f2d5fa08c64561af06d5479278eef15d773a38573a28e398d8c4",
|
||||
"retrieved_at": "2026-10-29T19:06:47.792376+00:00",
|
||||
"published_at": "2025-01-05T19:11:07.919704Z",
|
||||
"registry_exposes_commit": false,
|
||||
"artifact_installed_or_imported": false,
|
||||
"members": [
|
||||
{
|
||||
"path": ".github/dependabot.yml",
|
||||
"sha256": "5fde656a6bd4df28fd72a57a054929feb13ab7a0feda9b79cd89d5341c1eab8f"
|
||||
},
|
||||
{
|
||||
"path": ".github/workflows/publish.yml",
|
||||
"sha256": "fcc303b0b70778d3053f9ebf3c058f8d2e1062153f3504410bead4e5446c4ee9"
|
||||
},
|
||||
{
|
||||
"path": ".gitignore",
|
||||
"sha256": "8af92c9f9fbbec40889722e8413ce8fb189258fdb5d54509678ed2bdc5d637bd"
|
||||
},
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "686ef502d7dfec641b2f690142f36903fb1d2f8952bf252e754bf8ac1a11963d"
|
||||
},
|
||||
{
|
||||
"path": "__init__.py",
|
||||
"sha256": "7968717a19aa0aa9b3c4b2daaeef8ae64196ac0f0fb402d418a2809a9bd22663"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Extract Instrumental from Song.jpg",
|
||||
"sha256": "9b8b860690a36e25b4c19c04e594cce6264c8a8ae2fd48c24cd7a4c6d54fca8f"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Extract Instrumental from Song.json",
|
||||
"sha256": "db483ac9b80485a883c1f3edc40b367c1270ebfe3d93d18fc07813b1611e965c"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Isolate Vocals from Audio.jpg",
|
||||
"sha256": "404e4e1909d5b1930a5aa18609359e72fb1647f4dddbbe756650726702eb3b01"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Isolate Vocals from Audio.json",
|
||||
"sha256": "8a1e7777d3d62faf8508ab5d7e84c8a887b134369bac5191fa0d91185bf9a008"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Isolate Vocals from Video.jpg",
|
||||
"sha256": "8cb216c1d5aad352b9a8b68d64372bff7252d7c01d5e79c44d4c5500925d1e6c"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Isolate Vocals from Video.json",
|
||||
"sha256": "f64d56730ab7ea0f056dbdc6f2e2b282075697eb9dfc0144250787732c761915"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Remix Song.jpg",
|
||||
"sha256": "b423aa643c8c7db5da8fea5e6ddd88e953b0ddd46c41cea72e576da4c35239ad"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Remix Song.json",
|
||||
"sha256": "44d146ce0b80299bb1a7503af83c20571d2440fe12766987d1f3f8d861369481"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Replace BGM with Stable-Audio-Generated Music.jpg",
|
||||
"sha256": "3b851a3b48c158ef8d5f37a985ef2dc52184ca8d3e154c74098a48abe65dc23e"
|
||||
},
|
||||
{
|
||||
"path": "example_workflows/Replace BGM with Stable-Audio-Generated Music.json",
|
||||
"sha256": "6f4d761e10aedc108c256324fd2139fc158743bd89b28ecb3be428b445d96df6"
|
||||
},
|
||||
{
|
||||
"path": "pyproject.toml",
|
||||
"sha256": "87acc158dbdc300127bc9154e4ca1b905c139c9434726797995d2b3629d7b0a1"
|
||||
},
|
||||
{
|
||||
"path": "requirements.txt",
|
||||
"sha256": "e93998169bb747c852c5b5307415e7ae2d4dcdd4f29cee77c9b0c8b0819b7de3"
|
||||
},
|
||||
{
|
||||
"path": "src/__init__.py",
|
||||
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
},
|
||||
{
|
||||
"path": "src/_types.py",
|
||||
"sha256": "c9c81f4325733514e10ce0efdbb4432680ae93366337ae5ebaa4039ac27586b1"
|
||||
},
|
||||
{
|
||||
"path": "src/combine.py",
|
||||
"sha256": "33f09616ae3460c812a6a2a6af4384ec54a4f58fdd48f24de7a52be17b06b293"
|
||||
},
|
||||
{
|
||||
"path": "src/combine_video_with_audio.py",
|
||||
"sha256": "ff96f6f73fac08fcecd08c9319e7c919cfbdb4a07b02d1869d7c141bb38afaea"
|
||||
},
|
||||
{
|
||||
"path": "src/crop.py",
|
||||
"sha256": "a2ac02bd7b42efd6de665c51edd7c698bb3ba97939574a9e06a99917a614f56c"
|
||||
},
|
||||
{
|
||||
"path": "src/get_tempo.py",
|
||||
"sha256": "f5a85914c6d81110ea5e7d048772615beaf2cd35f84d51a0170b7c8a3996a4c6"
|
||||
},
|
||||
{
|
||||
"path": "src/resample.py",
|
||||
"sha256": "6cdc1dd1fcbfccade49a032fe9775bf9290f8113cb6e7c239bafec85cc56f304"
|
||||
},
|
||||
{
|
||||
"path": "src/separation.py",
|
||||
"sha256": "08605b797d8f086c7692f6af1df716af692e77a0c810277e2b0467c45ac66ed0"
|
||||
},
|
||||
{
|
||||
"path": "src/tempo_match.py",
|
||||
"sha256": "926bd0f9c6a77fc150d133a5e1330f18432506ba1ed319bfb61b48d2f0771793"
|
||||
},
|
||||
{
|
||||
"path": "src/time_shift.py",
|
||||
"sha256": "a8f5e22aab83fa1c4e58381d04742d6e07dcc500067696b86c575e0ce82ff8c6"
|
||||
},
|
||||
{
|
||||
"path": "src/utils.py",
|
||||
"sha256": "eac3eda009fce6592880100f55d9cbab5f64c8721b98a8fc059d3e27638f02dc"
|
||||
}
|
||||
],
|
||||
"matching_selected_sources": {
|
||||
"commit": "5291831d7c321ab7a5192374482f9848dffee75b",
|
||||
"files": [
|
||||
{
|
||||
"file": "pyproject.toml",
|
||||
"sha256": "87acc158dbdc300127bc9154e4ca1b905c139c9434726797995d2b3629d7b0a1",
|
||||
"registry_member_equal": true
|
||||
},
|
||||
{
|
||||
"file": "__init__.py",
|
||||
"sha256": "7968717a19aa0aa9b3c4b2daaeef8ae64196ac0f0fb402d418a2809a9bd22663",
|
||||
"registry_member_equal": true
|
||||
},
|
||||
{
|
||||
"file": "src/separation.py",
|
||||
"sha256": "08605b797d8f086c7692f6af1df716af692e77a0c810277e2b0467c45ac66ed0",
|
||||
"registry_member_equal": true
|
||||
},
|
||||
{
|
||||
"file": ".github/workflows/publish.yml",
|
||||
"sha256": "fcc303b0b70778d3053f9ebf3c058f8d2e1062153f3504410bead4e5446c4ee9",
|
||||
"registry_member_equal": true
|
||||
},
|
||||
{
|
||||
"file": "README.md",
|
||||
"sha256": "686ef502d7dfec641b2f690142f36903fb1d2f8952bf252e754bf8ac1a11963d",
|
||||
"registry_member_equal": true
|
||||
}
|
||||
],
|
||||
"registry_commit_binding": "not exposed by registry API; matching selected source bytes is not a signed release mapping",
|
||||
"license": "pyproject names LICENSE, but no license file in this commit/package; unknown. MIT only added later at 504248bd, not retroactively assigned"
|
||||
},
|
||||
"target_installation_match": "unknown"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,22 @@
|
||||
[project]
|
||||
name = "audio-separation-nodes-comfyui"
|
||||
description = "Separate audio track into stems (vocals, bass, drums, other). Along with tools to recombine, tempo match, slice/crop audio"
|
||||
version = "1.4.1"
|
||||
license = { file = "LICENSE" }
|
||||
dependencies = ["librosa==0.10.2", "numpy", "torchaudio>=2.3.0", "moviepy"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = ["pytest"]
|
||||
dev = ["ruff"]
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py39"
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/christian-byrne/audio-separation-nodes-comfyui"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "christian-byrne"
|
||||
DisplayName = "audio-separation-nodes-comfyui"
|
||||
Icon = "https://img.icons8.com/?size=100&id=gSULe4i1JTpL&format=png&color=000000"
|
||||
@@ -0,0 +1,22 @@
|
||||
[project]
|
||||
name = "audio-separation-nodes-comfyui"
|
||||
description = "Separate audio track into stems (vocals, bass, drums, other). Along with tools to recombine, tempo match, slice/crop audio"
|
||||
version = "1.5.0"
|
||||
license = { file = "LICENSE" }
|
||||
dependencies = ["librosa==0.10.2", "numpy", "torchaudio>=2.3.0", "moviepy"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = ["pytest"]
|
||||
dev = ["ruff"]
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py39"
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/christian-byrne/audio-separation-nodes-comfyui"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "christian-byrne"
|
||||
DisplayName = "audio-separation-nodes-comfyui"
|
||||
Icon = "https://img.icons8.com/?size=100&id=gSULe4i1JTpL&format=png&color=000000"
|
||||
@@ -0,0 +1,23 @@
|
||||
name: Publish to Comfy registry
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
|
||||
jobs:
|
||||
publish-node:
|
||||
name: Publish Custom Node to registry
|
||||
runs-on: ubuntu-latest
|
||||
# if this is a forked repository. Skipping the workflow.
|
||||
if: github.event.repository.fork == false
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish Custom Node
|
||||
uses: Comfy-Org/publish-node-action@main
|
||||
with:
|
||||
## Add your own personal access token to your Github Repository secrets and reference it here.
|
||||
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
@@ -0,0 +1,91 @@
|
||||

|
||||
|
||||
https://github.com/user-attachments/assets/c5cf20de-a17f-438d-81ac-0c392af669cf
|
||||
|
||||
# Examples
|
||||
|
||||
#### _`Separating Voices in a Video`_
|
||||
|
||||
<details>
|
||||
|
||||
<summary> Show </summary>
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> In order to load videos into the LoadAudio Node, change [this line](https://github.com/comfyanonymous/ComfyUI/blob/faa57430b0ff882275b1afcf6610e8e9f8a5929b/comfy_extras/nodes_audio.py#L185) in your Comfy install to include the video's extension (e.g., `.mp4`)
|
||||
|
||||
[workflow.json](./example_workflows/isolate-vocals-video.json)
|
||||
|
||||
https://github.com/user-attachments/assets/c5af418e-7137-4c36-b86e-3352cf558ea8
|
||||
|
||||
</details>
|
||||
|
||||
#### _`Replacing BGM with StableAudio-Generated BGM`_
|
||||
|
||||
<details>
|
||||
|
||||
<summary> Show </summary>
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> In order to load videos into the LoadAudio Node, change [this line](https://github.com/comfyanonymous/ComfyUI/blob/faa57430b0ff882275b1afcf6610e8e9f8a5929b/comfy_extras/nodes_audio.py#L185) in your Comfy install to include the video's extension (e.g., `.mp4`)
|
||||
|
||||
You can use this to replace copyrighted BGM in a video with new BGM. You can set the denoise low, so that the new BGM is still stimilar to the original.
|
||||
|
||||
[workflow json](./example_workflows/replace-bgm.json)
|
||||
|
||||
https://github.com/user-attachments/assets/a7d5656b-5f8b-439a-936f-6ebb6a0d538a
|
||||
|
||||
</details>
|
||||
|
||||
#### _`Remixing Songs with StableAudio`_
|
||||
|
||||
<details>
|
||||
|
||||
<summary> Show </summary>
|
||||
|
||||
- [workflow json](./example_workflows/remix-songs.json)
|
||||
- [example output (audio file) with embedded workflow](https://github.com/christian-byrne/audio-separation-nodes-comfyui/raw/refs/heads/demo-files/wiki/examples/ComfyUI_temp_iaepj_00001_.flac)
|
||||
- [example output (audio file) with embedded workflow](https://github.com/christian-byrne/audio-separation-nodes-comfyui/raw/refs/heads/demo-files/wiki/examples/ComfyUI_00002_.flac)
|
||||
|
||||
</details>
|
||||
|
||||
#### _`Separating Song Vocals`_
|
||||
|
||||
<details>
|
||||
|
||||
<summary> Show </summary>
|
||||
|
||||
[workflow.json](./example_workflows/isolate-vocals-song.json)
|
||||
|
||||
https://github.com/user-attachments/assets/c5cf20de-a17f-438d-81ac-0c392af669cf
|
||||
|
||||
</details>
|
||||
|
||||
#### _`Extracting Instrumentals from Songs`_
|
||||
|
||||
<details>
|
||||
|
||||
<summary> Show </summary>
|
||||
|
||||
- [workflow json](./example_workflows/extract-instrumental.json)
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
|
||||
# Requirements
|
||||
|
||||
```m
|
||||
librosa==0.10.2
|
||||
torchaudio>=2.3.0
|
||||
numpy
|
||||
moviepy
|
||||
```
|
||||
|
||||
# Installation
|
||||
|
||||
1. If you run ComfyUI inside of a virtual environment, make sure it is activated
|
||||
1. `git clone` this repository in `ComfyUI/custom_nodes` folder
|
||||
1. `cd` into the cloned repository
|
||||
1. `pip install -r requirements.txt`
|
||||
@@ -0,0 +1,18 @@
|
||||
from .src.separation import AudioSeparation
|
||||
from .src.tempo_match import TempoMatch
|
||||
from .src.crop import AudioCrop
|
||||
from .src.combine import AudioCombine
|
||||
from .src.combine_video_with_audio import AudioVideoCombine
|
||||
from .src.time_shift import TimeShift
|
||||
from .src.get_tempo import GetTempo
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"AudioSeparation": AudioSeparation,
|
||||
"AudioCrop": AudioCrop,
|
||||
"AudioCombine": AudioCombine,
|
||||
"AudioTempoMatch": TempoMatch,
|
||||
"AudioVideoCombine": AudioVideoCombine,
|
||||
"AudioSpeedShift": TimeShift,
|
||||
"AudioGetTempo": GetTempo,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[project]
|
||||
name = "audio-separation-nodes-comfyui"
|
||||
description = "Separate audio track into stems (vocals, bass, drums, other). Along with tools to recombine, tempo match, slice/crop audio"
|
||||
version = "1.4.0"
|
||||
license = "LICENSE"
|
||||
dependencies = ["librosa==0.10.2", "numpy", "torchaudio>=2.3.0", "moviepy"]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/christian-byrne/audio-separation-nodes-comfyui"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "christian-byrne"
|
||||
DisplayName = "audio-separation-nodes-comfyui"
|
||||
Icon = "https://img.icons8.com/?size=100&id=gSULe4i1JTpL&format=png&color=000000"
|
||||
@@ -0,0 +1,171 @@
|
||||
"""Credit: https://pytorch.org/audio/stable/tutorials/hybrid_demucs_tutorial.html"""
|
||||
|
||||
import torch
|
||||
from torchaudio.transforms import Fade, Resample
|
||||
from torchaudio.pipelines import HDEMUCS_HIGH_MUSDB_PLUS
|
||||
|
||||
import comfy.model_management
|
||||
|
||||
from typing import Dict, Tuple
|
||||
from ._types import AUDIO
|
||||
from .utils import ensure_stereo
|
||||
|
||||
|
||||
class AudioSeparation:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"audio": ("AUDIO",),
|
||||
},
|
||||
"optional": {
|
||||
"chunk_fade_shape": (
|
||||
[
|
||||
"linear",
|
||||
"half_sine",
|
||||
"logarithmic",
|
||||
"exponential",
|
||||
],
|
||||
{
|
||||
"default": "linear",
|
||||
"tooltip": "Audio is split into segments (chunks) with overlapping areas to ensure smooth transitions. This setting controls the fade effect at these overlaps. Choose Linear for even fading, Half-Sine for a smooth curve, Logarithmic for a quick fade out and slow fade in, or Exponential for a slow fade out and quick fade in.",
|
||||
},
|
||||
),
|
||||
"chunk_length": (
|
||||
"FLOAT",
|
||||
{
|
||||
"default": 10.0,
|
||||
"tooltip": "The length of each segment (chunk) in seconds. Longer chunks may require more memory and MIGHT produce better results.",
|
||||
},
|
||||
),
|
||||
"chunk_overlap": (
|
||||
"FLOAT",
|
||||
{
|
||||
"default": 0.1,
|
||||
"tooltip": "The overlap between each segment (chunk) in seconds. A higher overlap may be necessary if chunks are too short or the audio changes rapidly.",
|
||||
},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "main"
|
||||
RETURN_TYPES = ("AUDIO", "AUDIO", "AUDIO", "AUDIO")
|
||||
RETURN_NAMES = ("Bass", "Drums", "Other", "Vocals")
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Separate audio into four sources: bass, drums, other, and vocals."
|
||||
|
||||
def main(
|
||||
self,
|
||||
audio: AUDIO,
|
||||
chunk_fade_shape: str = "linear",
|
||||
chunk_length: float = 10.0,
|
||||
chunk_overlap: float = 0.1,
|
||||
) -> Tuple[AUDIO, AUDIO, AUDIO, AUDIO]:
|
||||
|
||||
device: torch.device = comfy.model_management.get_torch_device()
|
||||
waveform: torch.Tensor = audio["waveform"]
|
||||
waveform = waveform.squeeze(0).to(device)
|
||||
self.input_sample_rate_: int = audio["sample_rate"]
|
||||
|
||||
bundle = HDEMUCS_HIGH_MUSDB_PLUS
|
||||
model: torch.nn.Module = bundle.get_model().to(device)
|
||||
self.model_sample_rate = bundle.sample_rate
|
||||
|
||||
waveform = ensure_stereo(waveform)
|
||||
|
||||
# Resample to model's expected sample rate
|
||||
if self.input_sample_rate_ != self.model_sample_rate:
|
||||
resample = Resample(self.input_sample_rate_, self.model_sample_rate).to(
|
||||
device
|
||||
)
|
||||
waveform = resample(waveform)
|
||||
|
||||
ref = waveform.mean(0)
|
||||
waveform = (waveform - ref.mean()) / ref.std() # Zs
|
||||
|
||||
sources = self.separate_sources(
|
||||
model,
|
||||
waveform[None],
|
||||
self.model_sample_rate,
|
||||
segment=chunk_length,
|
||||
overlap=chunk_overlap,
|
||||
device=device,
|
||||
chunk_fade_shape=chunk_fade_shape,
|
||||
)[0]
|
||||
sources = sources * ref.std() + ref.mean()
|
||||
sources_list = model.sources
|
||||
sources = list(sources)
|
||||
|
||||
return self.sources_to_tuple(dict(zip(sources_list, sources)))
|
||||
|
||||
def sources_to_tuple(
|
||||
self, sources: Dict[str, torch.Tensor]
|
||||
) -> Tuple[AUDIO, AUDIO, AUDIO, AUDIO]:
|
||||
|
||||
output_order = ["bass", "drums", "other", "vocals"]
|
||||
outputs = []
|
||||
for source in output_order:
|
||||
if source not in sources:
|
||||
raise ValueError(f"Missing source {source} in the output")
|
||||
outputs.append(
|
||||
{
|
||||
"waveform": sources[source].cpu().unsqueeze(0),
|
||||
"sample_rate": self.model_sample_rate,
|
||||
}
|
||||
)
|
||||
return tuple(outputs)
|
||||
|
||||
def separate_sources(
|
||||
self,
|
||||
model: torch.nn.Module,
|
||||
mix: torch.Tensor,
|
||||
sample_rate: int,
|
||||
segment: float = 10.0,
|
||||
overlap: float = 0.1,
|
||||
device: torch.device = None,
|
||||
chunk_fade_shape: str = "linear",
|
||||
) -> torch.Tensor:
|
||||
"""
|
||||
From: https://pytorch.org/audio/stable/tutorials/hybrid_demucs_tutorial.html
|
||||
|
||||
Apply model to a given mixture. Use fade, and add segments together in order to add model segment by segment.
|
||||
|
||||
Args:
|
||||
segment (int): segment length in seconds
|
||||
device (torch.device, str, or None): if provided, device on which to
|
||||
execute the computation, otherwise `mix.device` is assumed.
|
||||
When `device` is different from `mix.device`, only local computations will
|
||||
be on `device`, while the entire tracks will be stored on `mix.device`.
|
||||
"""
|
||||
if device is None:
|
||||
device = mix.device
|
||||
else:
|
||||
device = torch.device(device)
|
||||
|
||||
batch, channels, length = mix.shape
|
||||
|
||||
chunk_len = int(sample_rate * segment * (1 + overlap))
|
||||
start = 0
|
||||
end = chunk_len
|
||||
overlap_frames = overlap * sample_rate
|
||||
fade = Fade(
|
||||
fade_in_len=0, fade_out_len=int(overlap_frames), fade_shape=chunk_fade_shape
|
||||
)
|
||||
|
||||
final = torch.zeros(batch, len(model.sources), channels, length, device=device)
|
||||
|
||||
while start < length - overlap_frames:
|
||||
chunk = mix[:, :, start:end]
|
||||
with torch.no_grad():
|
||||
out = model.forward(chunk)
|
||||
out = fade(out)
|
||||
final[:, :, :, start:end] += out
|
||||
if start == 0:
|
||||
fade.fade_in_len = int(overlap_frames)
|
||||
start += int(chunk_len - overlap_frames)
|
||||
else:
|
||||
start += chunk_len
|
||||
end += chunk_len
|
||||
if end >= length:
|
||||
fade.fade_out_len = 0
|
||||
return final
|
||||
@@ -0,0 +1,15 @@
|
||||
[project]
|
||||
name = "audio-separation-nodes-comfyui"
|
||||
description = "Separate audio track into stems (vocals, bass, drums, other). Along with tools to recombine, tempo match, slice/crop audio"
|
||||
version = "1.4.1"
|
||||
license = "LICENSE"
|
||||
dependencies = ["librosa==0.10.2", "numpy", "torchaudio>=2.3.0", "moviepy"]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/christian-byrne/audio-separation-nodes-comfyui"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "christian-byrne"
|
||||
DisplayName = "audio-separation-nodes-comfyui"
|
||||
Icon = "https://img.icons8.com/?size=100&id=gSULe4i1JTpL&format=png&color=000000"
|
||||
@@ -0,0 +1,15 @@
|
||||
[project]
|
||||
name = "audio-separation-nodes-comfyui"
|
||||
description = "Separate audio track into stems (vocals, bass, drums, other). Along with tools to recombine, tempo match, slice/crop audio"
|
||||
version = "1.3.1"
|
||||
license = "LICENSE"
|
||||
dependencies = ["librosa==0.10.2", "numpy", "torchaudio>=2.3.0", "moviepy"]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/christian-byrne/audio-separation-nodes-comfyui"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "christian-byrne"
|
||||
DisplayName = "audio-separation-nodes-comfyui"
|
||||
Icon = "https://img.icons8.com/?size=100&id=gSULe4i1JTpL&format=png&color=000000"
|
||||
@@ -0,0 +1,22 @@
|
||||
[project]
|
||||
name = "audio-separation-nodes-comfyui"
|
||||
description = "Separate audio track into stems (vocals, bass, drums, other). Along with tools to recombine, tempo match, slice/crop audio"
|
||||
version = "1.4.1"
|
||||
license = "LICENSE"
|
||||
dependencies = ["librosa==0.10.2", "numpy", "torchaudio>=2.3.0", "moviepy"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = ["pytest"]
|
||||
dev = ["ruff"]
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py39"
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/christian-byrne/audio-separation-nodes-comfyui"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "christian-byrne"
|
||||
DisplayName = "audio-separation-nodes-comfyui"
|
||||
Icon = "https://img.icons8.com/?size=100&id=gSULe4i1JTpL&format=png&color=000000"
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
[{"name":"v2.0.0","zipball_url":"https://api.github.com/repos/christian-byrne/audio-separation-nodes-comfyui/zipball/refs/tags/v2.0.0","tarball_url":"https://api.github.com/repos/christian-byrne/audio-separation-nodes-comfyui/tarball/refs/tags/v2.0.0","commit":{"sha":"bb42b2d210c0335986ed922cbe8231b10f0ffabb","url":"https://api.github.com/repos/christian-byrne/audio-separation-nodes-comfyui/commits/bb42b2d210c0335986ed922cbe8231b10f0ffabb"},"node_id":"REF_kwDOMRYcBrByZWZzL3RhZ3MvdjIuMC4w"}]
|
||||
@@ -0,0 +1 @@
|
||||
{"changelog":"","createdAt":"2025-01-05T19:11:07.919704Z","dependencies":["librosa==0.10.2","numpy","torchaudio\u003e=2.3.0","moviepy"],"deprecated":false,"downloadUrl":"https://cdn.comfy.org/christian-byrne/audio-separation-nodes-comfyui/1.4.0/node.zip","id":"08cc8745-19bc-4c78-80a9-6fcb97ef4da1","node_id":"audio-separation-nodes-comfyui","status":"NodeVersionStatusActive","supported_accelerators":null,"supported_comfyui_frontend_version":"","supported_comfyui_version":"","supported_os":null,"tags":[],"version":"1.4.0"}
|
||||
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"commit": "5291831d7c321ab7a5192374482f9848dffee75b",
|
||||
"files": [
|
||||
{
|
||||
"file": "pyproject.toml",
|
||||
"sha256": "87acc158dbdc300127bc9154e4ca1b905c139c9434726797995d2b3629d7b0a1",
|
||||
"registry_member_equal": true
|
||||
},
|
||||
{
|
||||
"file": "__init__.py",
|
||||
"sha256": "7968717a19aa0aa9b3c4b2daaeef8ae64196ac0f0fb402d418a2809a9bd22663",
|
||||
"registry_member_equal": true
|
||||
},
|
||||
{
|
||||
"file": "src/separation.py",
|
||||
"sha256": "08605b797d8f086c7692f6af1df716af692e77a0c810277e2b0467c45ac66ed0",
|
||||
"registry_member_equal": true
|
||||
},
|
||||
{
|
||||
"file": ".github/workflows/publish.yml",
|
||||
"sha256": "fcc303b0b70778d3053f9ebf3c058f8d2e1062153f3504410bead4e5446c4ee9",
|
||||
"registry_member_equal": true
|
||||
},
|
||||
{
|
||||
"file": "README.md",
|
||||
"sha256": "686ef502d7dfec641b2f690142f36903fb1d2f8952bf252e754bf8ac1a11963d",
|
||||
"registry_member_equal": true
|
||||
}
|
||||
],
|
||||
"registry_commit_binding": "not exposed by registry API; matching selected source bytes is not a signed release mapping",
|
||||
"license": "pyproject names LICENSE, but no license file in this commit/package; unknown. MIT only added later at 504248bd, not retroactively assigned"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
from .src.separation import AudioSeparation
|
||||
from .src.tempo_match import TempoMatch
|
||||
from .src.crop import AudioCrop
|
||||
from .src.combine import AudioCombine
|
||||
from .src.combine_video_with_audio import AudioVideoCombine
|
||||
from .src.time_shift import TimeShift
|
||||
from .src.get_tempo import GetTempo
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"AudioSeparation": AudioSeparation,
|
||||
"AudioCrop": AudioCrop,
|
||||
"AudioCombine": AudioCombine,
|
||||
"AudioTempoMatch": TempoMatch,
|
||||
"AudioVideoCombine": AudioVideoCombine,
|
||||
"AudioSpeedShift": TimeShift,
|
||||
"AudioGetTempo": GetTempo,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[project]
|
||||
name = "audio-separation-nodes-comfyui"
|
||||
description = "Separate audio track into stems (vocals, bass, drums, other). Along with tools to recombine, tempo match, slice/crop audio"
|
||||
version = "1.4.0"
|
||||
license = "LICENSE"
|
||||
dependencies = ["librosa==0.10.2", "numpy", "torchaudio>=2.3.0", "moviepy"]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/christian-byrne/audio-separation-nodes-comfyui"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "christian-byrne"
|
||||
DisplayName = "audio-separation-nodes-comfyui"
|
||||
Icon = "https://img.icons8.com/?size=100&id=gSULe4i1JTpL&format=png&color=000000"
|
||||
@@ -0,0 +1,171 @@
|
||||
"""Credit: https://pytorch.org/audio/stable/tutorials/hybrid_demucs_tutorial.html"""
|
||||
|
||||
import torch
|
||||
from torchaudio.transforms import Fade, Resample
|
||||
from torchaudio.pipelines import HDEMUCS_HIGH_MUSDB_PLUS
|
||||
|
||||
import comfy.model_management
|
||||
|
||||
from typing import Dict, Tuple
|
||||
from ._types import AUDIO
|
||||
from .utils import ensure_stereo
|
||||
|
||||
|
||||
class AudioSeparation:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"audio": ("AUDIO",),
|
||||
},
|
||||
"optional": {
|
||||
"chunk_fade_shape": (
|
||||
[
|
||||
"linear",
|
||||
"half_sine",
|
||||
"logarithmic",
|
||||
"exponential",
|
||||
],
|
||||
{
|
||||
"default": "linear",
|
||||
"tooltip": "Audio is split into segments (chunks) with overlapping areas to ensure smooth transitions. This setting controls the fade effect at these overlaps. Choose Linear for even fading, Half-Sine for a smooth curve, Logarithmic for a quick fade out and slow fade in, or Exponential for a slow fade out and quick fade in.",
|
||||
},
|
||||
),
|
||||
"chunk_length": (
|
||||
"FLOAT",
|
||||
{
|
||||
"default": 10.0,
|
||||
"tooltip": "The length of each segment (chunk) in seconds. Longer chunks may require more memory and MIGHT produce better results.",
|
||||
},
|
||||
),
|
||||
"chunk_overlap": (
|
||||
"FLOAT",
|
||||
{
|
||||
"default": 0.1,
|
||||
"tooltip": "The overlap between each segment (chunk) in seconds. A higher overlap may be necessary if chunks are too short or the audio changes rapidly.",
|
||||
},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
FUNCTION = "main"
|
||||
RETURN_TYPES = ("AUDIO", "AUDIO", "AUDIO", "AUDIO")
|
||||
RETURN_NAMES = ("Bass", "Drums", "Other", "Vocals")
|
||||
CATEGORY = "audio"
|
||||
DESCRIPTION = "Separate audio into four sources: bass, drums, other, and vocals."
|
||||
|
||||
def main(
|
||||
self,
|
||||
audio: AUDIO,
|
||||
chunk_fade_shape: str = "linear",
|
||||
chunk_length: float = 10.0,
|
||||
chunk_overlap: float = 0.1,
|
||||
) -> Tuple[AUDIO, AUDIO, AUDIO, AUDIO]:
|
||||
|
||||
device: torch.device = comfy.model_management.get_torch_device()
|
||||
waveform: torch.Tensor = audio["waveform"]
|
||||
waveform = waveform.squeeze(0).to(device)
|
||||
self.input_sample_rate_: int = audio["sample_rate"]
|
||||
|
||||
bundle = HDEMUCS_HIGH_MUSDB_PLUS
|
||||
model: torch.nn.Module = bundle.get_model().to(device)
|
||||
self.model_sample_rate = bundle.sample_rate
|
||||
|
||||
waveform = ensure_stereo(waveform)
|
||||
|
||||
# Resample to model's expected sample rate
|
||||
if self.input_sample_rate_ != self.model_sample_rate:
|
||||
resample = Resample(self.input_sample_rate_, self.model_sample_rate).to(
|
||||
device
|
||||
)
|
||||
waveform = resample(waveform)
|
||||
|
||||
ref = waveform.mean(0)
|
||||
waveform = (waveform - ref.mean()) / ref.std() # Zs
|
||||
|
||||
sources = self.separate_sources(
|
||||
model,
|
||||
waveform[None],
|
||||
self.model_sample_rate,
|
||||
segment=chunk_length,
|
||||
overlap=chunk_overlap,
|
||||
device=device,
|
||||
chunk_fade_shape=chunk_fade_shape,
|
||||
)[0]
|
||||
sources = sources * ref.std() + ref.mean()
|
||||
sources_list = model.sources
|
||||
sources = list(sources)
|
||||
|
||||
return self.sources_to_tuple(dict(zip(sources_list, sources)))
|
||||
|
||||
def sources_to_tuple(
|
||||
self, sources: Dict[str, torch.Tensor]
|
||||
) -> Tuple[AUDIO, AUDIO, AUDIO, AUDIO]:
|
||||
|
||||
output_order = ["bass", "drums", "other", "vocals"]
|
||||
outputs = []
|
||||
for source in output_order:
|
||||
if source not in sources:
|
||||
raise ValueError(f"Missing source {source} in the output")
|
||||
outputs.append(
|
||||
{
|
||||
"waveform": sources[source].cpu().unsqueeze(0),
|
||||
"sample_rate": self.model_sample_rate,
|
||||
}
|
||||
)
|
||||
return tuple(outputs)
|
||||
|
||||
def separate_sources(
|
||||
self,
|
||||
model: torch.nn.Module,
|
||||
mix: torch.Tensor,
|
||||
sample_rate: int,
|
||||
segment: float = 10.0,
|
||||
overlap: float = 0.1,
|
||||
device: torch.device = None,
|
||||
chunk_fade_shape: str = "linear",
|
||||
) -> torch.Tensor:
|
||||
"""
|
||||
From: https://pytorch.org/audio/stable/tutorials/hybrid_demucs_tutorial.html
|
||||
|
||||
Apply model to a given mixture. Use fade, and add segments together in order to add model segment by segment.
|
||||
|
||||
Args:
|
||||
segment (int): segment length in seconds
|
||||
device (torch.device, str, or None): if provided, device on which to
|
||||
execute the computation, otherwise `mix.device` is assumed.
|
||||
When `device` is different from `mix.device`, only local computations will
|
||||
be on `device`, while the entire tracks will be stored on `mix.device`.
|
||||
"""
|
||||
if device is None:
|
||||
device = mix.device
|
||||
else:
|
||||
device = torch.device(device)
|
||||
|
||||
batch, channels, length = mix.shape
|
||||
|
||||
chunk_len = int(sample_rate * segment * (1 + overlap))
|
||||
start = 0
|
||||
end = chunk_len
|
||||
overlap_frames = overlap * sample_rate
|
||||
fade = Fade(
|
||||
fade_in_len=0, fade_out_len=int(overlap_frames), fade_shape=chunk_fade_shape
|
||||
)
|
||||
|
||||
final = torch.zeros(batch, len(model.sources), channels, length, device=device)
|
||||
|
||||
while start < length - overlap_frames:
|
||||
chunk = mix[:, :, start:end]
|
||||
with torch.no_grad():
|
||||
out = model.forward(chunk)
|
||||
out = fade(out)
|
||||
final[:, :, :, start:end] += out
|
||||
if start == 0:
|
||||
fade.fade_in_len = int(overlap_frames)
|
||||
start += int(chunk_len - overlap_frames)
|
||||
else:
|
||||
start += chunk_len
|
||||
end += chunk_len
|
||||
if end >= length:
|
||||
fade.fade_out_len = 0
|
||||
return final
|
||||
@@ -0,0 +1,438 @@
|
||||
{
|
||||
"authority": "public_reference_only_not_object_info",
|
||||
"source_entry_count": 13,
|
||||
"unique_id_count": 13,
|
||||
"sources": [
|
||||
{
|
||||
"id": "Comfy-Org/ComfyUI@265adad858e1f31b66cd3523a02b16f5d34ced52:comfy_extras/nodes_audio.py",
|
||||
"repository": "https://github.com/Comfy-Org/ComfyUI",
|
||||
"commit": "265adad858e1f31b66cd3523a02b16f5d34ced52",
|
||||
"file": "comfy_extras/nodes_audio.py",
|
||||
"url": "https://github.com/Comfy-Org/ComfyUI/blob/265adad858e1f31b66cd3523a02b16f5d34ced52/comfy_extras/nodes_audio.py",
|
||||
"raw_url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/265adad858e1f31b66cd3523a02b16f5d34ced52/comfy_extras/nodes_audio.py",
|
||||
"local_file": "core-0.3.68__comfy_extras__nodes_audio.py",
|
||||
"sha256": "28c8c4b19af120acabf7c35d66b89e14f47f2aa08d91dfda5eb1ee651c4ab4b7",
|
||||
"retrieved_at": "2026-10-29T19:06:39.792308+00:00",
|
||||
"license": "GPL-3.0",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
614
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"SaveAudio definition": [
|
||||
196,
|
||||
218
|
||||
],
|
||||
"SaveAudioMP3 definition": [
|
||||
220,
|
||||
243
|
||||
],
|
||||
"PreviewAudio definition": [
|
||||
270,
|
||||
281
|
||||
],
|
||||
"LoadAudio definition": [
|
||||
319,
|
||||
349
|
||||
],
|
||||
"SaveAudioMP3 registration": [
|
||||
584,
|
||||
584
|
||||
],
|
||||
"LoadAudio registration": [
|
||||
586,
|
||||
586
|
||||
],
|
||||
"PreviewAudio registration": [
|
||||
587,
|
||||
587
|
||||
],
|
||||
"save_audio UI descriptors": [
|
||||
187,
|
||||
194
|
||||
],
|
||||
"MP3 codec options": [
|
||||
158,
|
||||
173
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "Comfy-Org/ComfyUI@265adad858e1f31b66cd3523a02b16f5d34ced52:nodes.py",
|
||||
"repository": "https://github.com/Comfy-Org/ComfyUI",
|
||||
"commit": "265adad858e1f31b66cd3523a02b16f5d34ced52",
|
||||
"file": "nodes.py",
|
||||
"url": "https://github.com/Comfy-Org/ComfyUI/blob/265adad858e1f31b66cd3523a02b16f5d34ced52/nodes.py",
|
||||
"raw_url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/265adad858e1f31b66cd3523a02b16f5d34ced52/nodes.py",
|
||||
"local_file": "core-0.3.68__nodes.py",
|
||||
"sha256": "c92e2e6e3af2ca1a1219276a28660a415f51eb0b02b994e2fb3639d3aca916b3",
|
||||
"retrieved_at": "2026-10-29T19:06:40.564315+00:00",
|
||||
"license": "GPL-3.0",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
2423
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"extra module list entry": [
|
||||
2293,
|
||||
2293
|
||||
],
|
||||
"extra module loading": [
|
||||
2337,
|
||||
2338
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "Comfy-Org/ComfyUI@265adad858e1f31b66cd3523a02b16f5d34ced52:execution.py",
|
||||
"repository": "https://github.com/Comfy-Org/ComfyUI",
|
||||
"commit": "265adad858e1f31b66cd3523a02b16f5d34ced52",
|
||||
"file": "execution.py",
|
||||
"url": "https://github.com/Comfy-Org/ComfyUI/blob/265adad858e1f31b66cd3523a02b16f5d34ced52/execution.py",
|
||||
"raw_url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/265adad858e1f31b66cd3523a02b16f5d34ced52/execution.py",
|
||||
"local_file": "core-0.3.68__execution.py",
|
||||
"sha256": "d8db3b6f0874f2a7d1ac627f36b4ef668780c4dffa2db1e2e109f22f1663bb41",
|
||||
"retrieved_at": "2026-10-29T19:06:41.360322+00:00",
|
||||
"license": "GPL-3.0",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
1232
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"legacy UI merge": [
|
||||
331,
|
||||
394
|
||||
],
|
||||
"UI cache": [
|
||||
520,
|
||||
531
|
||||
],
|
||||
"history result": [
|
||||
723,
|
||||
734
|
||||
],
|
||||
"queue history storage": [
|
||||
1140,
|
||||
1145
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "Comfy-Org/ComfyUI@265adad858e1f31b66cd3523a02b16f5d34ced52:LICENSE",
|
||||
"repository": "https://github.com/Comfy-Org/ComfyUI",
|
||||
"commit": "265adad858e1f31b66cd3523a02b16f5d34ced52",
|
||||
"file": "LICENSE",
|
||||
"url": "https://github.com/Comfy-Org/ComfyUI/blob/265adad858e1f31b66cd3523a02b16f5d34ced52/LICENSE",
|
||||
"raw_url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/265adad858e1f31b66cd3523a02b16f5d34ced52/LICENSE",
|
||||
"local_file": "core-0.3.68__LICENSE",
|
||||
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
|
||||
"retrieved_at": "2026-10-29T19:06:42.004327+00:00",
|
||||
"license": "GPL-3.0",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
674
|
||||
]
|
||||
],
|
||||
"rule_locations": {},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "Comfy-Org/ComfyUI@c55fd7481626d8bee8044ea7512ea996d13a1b90:comfy_extras/nodes_audio.py",
|
||||
"repository": "https://github.com/Comfy-Org/ComfyUI",
|
||||
"commit": "c55fd7481626d8bee8044ea7512ea996d13a1b90",
|
||||
"file": "comfy_extras/nodes_audio.py",
|
||||
"url": "https://github.com/Comfy-Org/ComfyUI/blob/c55fd7481626d8bee8044ea7512ea996d13a1b90/comfy_extras/nodes_audio.py",
|
||||
"raw_url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/c55fd7481626d8bee8044ea7512ea996d13a1b90/comfy_extras/nodes_audio.py",
|
||||
"local_file": "core-0.3.71__comfy_extras__nodes_audio.py",
|
||||
"sha256": "28c8c4b19af120acabf7c35d66b89e14f47f2aa08d91dfda5eb1ee651c4ab4b7",
|
||||
"retrieved_at": "2026-10-29T19:06:42.792334+00:00",
|
||||
"license": "GPL-3.0",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
614
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"SaveAudio definition": [
|
||||
196,
|
||||
218
|
||||
],
|
||||
"SaveAudioMP3 definition": [
|
||||
220,
|
||||
243
|
||||
],
|
||||
"PreviewAudio definition": [
|
||||
270,
|
||||
281
|
||||
],
|
||||
"LoadAudio definition": [
|
||||
319,
|
||||
349
|
||||
],
|
||||
"SaveAudioMP3 registration": [
|
||||
584,
|
||||
584
|
||||
],
|
||||
"LoadAudio registration": [
|
||||
586,
|
||||
586
|
||||
],
|
||||
"PreviewAudio registration": [
|
||||
587,
|
||||
587
|
||||
],
|
||||
"save_audio UI descriptors": [
|
||||
187,
|
||||
194
|
||||
],
|
||||
"MP3 codec options": [
|
||||
158,
|
||||
173
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "Comfy-Org/ComfyUI@c55fd7481626d8bee8044ea7512ea996d13a1b90:nodes.py",
|
||||
"repository": "https://github.com/Comfy-Org/ComfyUI",
|
||||
"commit": "c55fd7481626d8bee8044ea7512ea996d13a1b90",
|
||||
"file": "nodes.py",
|
||||
"url": "https://github.com/Comfy-Org/ComfyUI/blob/c55fd7481626d8bee8044ea7512ea996d13a1b90/nodes.py",
|
||||
"raw_url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/c55fd7481626d8bee8044ea7512ea996d13a1b90/nodes.py",
|
||||
"local_file": "core-0.3.71__nodes.py",
|
||||
"sha256": "0c7a93f8aee98e01481501ac40721fadf43694e6e04f0b69c746c777ee3c9372",
|
||||
"retrieved_at": "2026-10-29T19:06:43.632341+00:00",
|
||||
"license": "GPL-3.0",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
2430
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"extra module list entry": [
|
||||
2298,
|
||||
2298
|
||||
],
|
||||
"extra module loading": [
|
||||
2343,
|
||||
2344
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "Comfy-Org/ComfyUI@c55fd7481626d8bee8044ea7512ea996d13a1b90:execution.py",
|
||||
"repository": "https://github.com/Comfy-Org/ComfyUI",
|
||||
"commit": "c55fd7481626d8bee8044ea7512ea996d13a1b90",
|
||||
"file": "execution.py",
|
||||
"url": "https://github.com/Comfy-Org/ComfyUI/blob/c55fd7481626d8bee8044ea7512ea996d13a1b90/execution.py",
|
||||
"raw_url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/c55fd7481626d8bee8044ea7512ea996d13a1b90/execution.py",
|
||||
"local_file": "core-0.3.71__execution.py",
|
||||
"sha256": "d8db3b6f0874f2a7d1ac627f36b4ef668780c4dffa2db1e2e109f22f1663bb41",
|
||||
"retrieved_at": "2026-10-29T19:06:44.332347+00:00",
|
||||
"license": "GPL-3.0",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
1232
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"legacy UI merge": [
|
||||
331,
|
||||
394
|
||||
],
|
||||
"UI cache": [
|
||||
520,
|
||||
531
|
||||
],
|
||||
"history result": [
|
||||
723,
|
||||
734
|
||||
],
|
||||
"queue history storage": [
|
||||
1140,
|
||||
1145
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "Comfy-Org/ComfyUI@c55fd7481626d8bee8044ea7512ea996d13a1b90:LICENSE",
|
||||
"repository": "https://github.com/Comfy-Org/ComfyUI",
|
||||
"commit": "c55fd7481626d8bee8044ea7512ea996d13a1b90",
|
||||
"file": "LICENSE",
|
||||
"url": "https://github.com/Comfy-Org/ComfyUI/blob/c55fd7481626d8bee8044ea7512ea996d13a1b90/LICENSE",
|
||||
"raw_url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/c55fd7481626d8bee8044ea7512ea996d13a1b90/LICENSE",
|
||||
"local_file": "core-0.3.71__LICENSE",
|
||||
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
|
||||
"retrieved_at": "2026-10-29T19:06:44.912352+00:00",
|
||||
"license": "GPL-3.0",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
674
|
||||
]
|
||||
],
|
||||
"rule_locations": {},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "christian-byrne/audio-separation-nodes-comfyui@5291831d7c321ab7a5192374482f9848dffee75b:src/separation.py",
|
||||
"repository": "https://github.com/christian-byrne/audio-separation-nodes-comfyui",
|
||||
"commit": "5291831d7c321ab7a5192374482f9848dffee75b",
|
||||
"file": "src/separation.py",
|
||||
"url": "https://github.com/christian-byrne/audio-separation-nodes-comfyui/blob/5291831d7c321ab7a5192374482f9848dffee75b/src/separation.py",
|
||||
"raw_url": "https://raw.githubusercontent.com/christian-byrne/audio-separation-nodes-comfyui/5291831d7c321ab7a5192374482f9848dffee75b/src/separation.py",
|
||||
"local_file": "plugin-5291831d__src__separation.py",
|
||||
"sha256": "08605b797d8f086c7692f6af1df716af692e77a0c810277e2b0467c45ac66ed0",
|
||||
"retrieved_at": "2026-10-29T19:07:49.404798+00:00",
|
||||
"license": "unknown; LICENSE referenced but absent at this commit and in registry package",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
171
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"schema": [
|
||||
14,
|
||||
50
|
||||
],
|
||||
"return names/types": [
|
||||
52,
|
||||
53
|
||||
],
|
||||
"source ordering": [
|
||||
100,
|
||||
117
|
||||
],
|
||||
"chunk math": [
|
||||
147,
|
||||
168
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "christian-byrne/audio-separation-nodes-comfyui@5291831d7c321ab7a5192374482f9848dffee75b:__init__.py",
|
||||
"repository": "https://github.com/christian-byrne/audio-separation-nodes-comfyui",
|
||||
"commit": "5291831d7c321ab7a5192374482f9848dffee75b",
|
||||
"file": "__init__.py",
|
||||
"url": "https://github.com/christian-byrne/audio-separation-nodes-comfyui/blob/5291831d7c321ab7a5192374482f9848dffee75b/__init__.py",
|
||||
"raw_url": "https://raw.githubusercontent.com/christian-byrne/audio-separation-nodes-comfyui/5291831d7c321ab7a5192374482f9848dffee75b/__init__.py",
|
||||
"local_file": "plugin-5291831d____init__.py",
|
||||
"sha256": "7968717a19aa0aa9b3c4b2daaeef8ae64196ac0f0fb402d418a2809a9bd22663",
|
||||
"retrieved_at": "2026-10-29T19:07:49.284798+00:00",
|
||||
"license": "unknown; LICENSE referenced but absent at this commit and in registry package",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
18
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"import": [
|
||||
1,
|
||||
1
|
||||
],
|
||||
"AudioSeparation registration": [
|
||||
11,
|
||||
11
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "christian-byrne/audio-separation-nodes-comfyui@5291831d7c321ab7a5192374482f9848dffee75b:pyproject.toml",
|
||||
"repository": "https://github.com/christian-byrne/audio-separation-nodes-comfyui",
|
||||
"commit": "5291831d7c321ab7a5192374482f9848dffee75b",
|
||||
"file": "pyproject.toml",
|
||||
"url": "https://github.com/christian-byrne/audio-separation-nodes-comfyui/blob/5291831d7c321ab7a5192374482f9848dffee75b/pyproject.toml",
|
||||
"raw_url": "https://raw.githubusercontent.com/christian-byrne/audio-separation-nodes-comfyui/5291831d7c321ab7a5192374482f9848dffee75b/pyproject.toml",
|
||||
"local_file": "plugin-5291831d__pyproject.toml",
|
||||
"sha256": "87acc158dbdc300127bc9154e4ca1b905c139c9434726797995d2b3629d7b0a1",
|
||||
"retrieved_at": "2026-10-29T19:07:49.092797+00:00",
|
||||
"license": "unknown; LICENSE referenced but absent at this commit and in registry package",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
15
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"name_version_license_repository": [
|
||||
1,
|
||||
9
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "christian-byrne/audio-separation-nodes-comfyui@5291831d7c321ab7a5192374482f9848dffee75b:.github/workflows/publish.yml",
|
||||
"repository": "https://github.com/christian-byrne/audio-separation-nodes-comfyui",
|
||||
"commit": "5291831d7c321ab7a5192374482f9848dffee75b",
|
||||
"file": ".github/workflows/publish.yml",
|
||||
"url": "https://github.com/christian-byrne/audio-separation-nodes-comfyui/blob/5291831d7c321ab7a5192374482f9848dffee75b/.github/workflows/publish.yml",
|
||||
"raw_url": "https://raw.githubusercontent.com/christian-byrne/audio-separation-nodes-comfyui/5291831d7c321ab7a5192374482f9848dffee75b/.github/workflows/publish.yml",
|
||||
"local_file": "plugin-5291831d__.github__workflows__publish.yml",
|
||||
"sha256": "fcc303b0b70778d3053f9ebf3c058f8d2e1062153f3504410bead4e5446c4ee9",
|
||||
"retrieved_at": "2026-10-29T19:07:49.392798+00:00",
|
||||
"license": "unknown; LICENSE referenced but absent at this commit and in registry package",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
23
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"publish trigger": [
|
||||
2,
|
||||
8
|
||||
],
|
||||
"publish action": [
|
||||
17,
|
||||
23
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
},
|
||||
{
|
||||
"id": "christian-byrne/audio-separation-nodes-comfyui@5291831d7c321ab7a5192374482f9848dffee75b:README.md",
|
||||
"repository": "https://github.com/christian-byrne/audio-separation-nodes-comfyui",
|
||||
"commit": "5291831d7c321ab7a5192374482f9848dffee75b",
|
||||
"file": "README.md",
|
||||
"url": "https://github.com/christian-byrne/audio-separation-nodes-comfyui/blob/5291831d7c321ab7a5192374482f9848dffee75b/README.md",
|
||||
"raw_url": "https://raw.githubusercontent.com/christian-byrne/audio-separation-nodes-comfyui/5291831d7c321ab7a5192374482f9848dffee75b/README.md",
|
||||
"local_file": "plugin-5291831d__README.md",
|
||||
"sha256": "686ef502d7dfec641b2f690142f36903fb1d2f8952bf252e754bf8ac1a11963d",
|
||||
"retrieved_at": "2026-10-29T19:07:49.496799+00:00",
|
||||
"license": "unknown; LICENSE referenced but absent at this commit and in registry package",
|
||||
"lines": [
|
||||
[
|
||||
1,
|
||||
91
|
||||
]
|
||||
],
|
||||
"rule_locations": {
|
||||
"declared behavior": [
|
||||
1,
|
||||
40
|
||||
]
|
||||
},
|
||||
"target_version_match": "unknown"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user