{"record":{"id":"e09ff8a2b9335c19","repo":"Comfy-Org/ComfyUI","slug":"audiosplit-input-audio-must-be-stereo-2-channels","errorCode":null,"errorMessage":"AudioSplit: Input audio must be stereo (2 channels), got {waveform.shape[1]} channel(s).","messagePattern":"AudioSplit: Input audio must be stereo \\(2 channels\\), got (.+?) channel\\(s\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_audio.py","lineNumber":510,"sourceCode":"            category=\"audio\",\n            inputs=[\n                IO.Audio.Input(\"audio\"),\n            ],\n            outputs=[\n                IO.Audio.Output(display_name=\"left\"),\n                IO.Audio.Output(display_name=\"right\"),\n            ],\n        )\n\n    @classmethod\n    def execute(cls, audio) -> IO.NodeOutput:\n        if audio is None:\n            return IO.NodeOutput(None, None)\n        waveform = audio[\"waveform\"]\n        sample_rate = audio[\"sample_rate\"]\n\n        if waveform.shape[1] != 2:\n            raise ValueError(f\"AudioSplit: Input audio must be stereo (2 channels), got {waveform.shape[1]} channel(s).\")\n\n        left_channel = waveform[..., 0:1, :]\n        right_channel = waveform[..., 1:2, :]\n\n        return IO.NodeOutput({\"waveform\": left_channel, \"sample_rate\": sample_rate}, {\"waveform\": right_channel, \"sample_rate\": sample_rate})\n\n    separate = execute  # TODO: remove\n\nclass JoinAudioChannels(IO.ComfyNode):\n    @classmethod\n    def define_schema(cls):\n        return IO.Schema(\n            node_id=\"JoinAudioChannels\",\n            display_name=\"Join Audio Channels\",\n            description=\"Joins left and right mono audio channels into a stereo audio.\",\n            category=\"audio\",\n            inputs=[\n                IO.Audio.Input(\"audio_left\"),","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_audio.py#L492-L528","documentation":"The stereo splitter indexes waveform[..., 0:1, :] and [..., 1:2, :], so it requires exactly 2 channels in dim 1. Mono (1), 5.1 (6), or any other channel count raises immediately with the offending count.","triggerScenarios":"Feeding mono audio (e.g. from JoinAudioChannel of a single channel, a mono TTS output, or a mono WAV via LoadAudio) into the split node; feeding multichannel surround audio.","commonSituations":"Workflows that assume line/video audio is stereo but receive mono narration; chains where an upstream channel op already collapsed to mono; device-specific mono capture.","solutions":["Check waveform.shape[1] before splitting and adapt (mono needs no split)","Convert to stereo first (torch.cat([wav, wav], dim=1)) if duplication is acceptable","Use SplitAudioChannels for arbitrary channel counts instead of the stereo-only AudioSplit","Fix the source/export to stereo if stereo is genuinely required"],"exampleFix":"// before\nleft, right = AudioSplit(audio)  # mono input -> raises\n\n// after\nif audio['waveform'].shape[1] == 1:\n    audio = {'waveform': audio['waveform'].repeat(1, 2, 1), 'sample_rate': audio['sample_rate']}\nleft, right = AudioSplit(audio)","handlingStrategy":"type-guard","validationCode":"if waveform.shape[1] != 2:\n    if waveform.shape[1] == 1:\n        waveform = waveform.repeat(1, 2, 1)  # mono -> stereo\n    else:\n        waveform = waveform[:, :2, :]  # take first two channels","typeGuard":"def is_stereo(audio) -> bool:\n    return audio is not None and audio['waveform'].shape[1] == 2","tryCatchPattern":null,"preventionTips":["Check the channel dim before stereo-only ops","Use SplitAudioChannels for arbitrary channel counts","Fix mono sources at export time when stereo is required"],"tags":["audio","channels","stereo","shape-mismatch"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}