Skip to content

Make audio processing nodes handle None -inputs#13879

Merged
alexisrolland merged 2 commits into
Comfy-Org:masterfrom
kijai:trim_audio
May 14, 2026
Merged

Make audio processing nodes handle None -inputs#13879
alexisrolland merged 2 commits into
Comfy-Org:masterfrom
kijai:trim_audio

Conversation

@kijai
Copy link
Copy Markdown
Collaborator

@kijai kijai commented May 13, 2026

GetVideoComponents returns None if video doesn't have audio, the CreateVideo handles it graciously, while none of the audio processing nodes do. This PR allows None input to flow through.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds consistent None-input handling across audio processing nodes in comfy_extras/nodes_audio.py. Nodes that require valid audio input (VAEEncodeAudio, SaveAudio variants, PreviewAudio) now validate and reject None with descriptive errors. Transformation and effect nodes (TrimAudioDuration, SplitAudioChannels, AudioAdjustVolume, AudioEqualizer3Band) return None passthrough when input is None. Combination nodes (JoinAudioChannels, AudioConcat, AudioMerge) return non-None inputs or None when both inputs are None. TrimAudioDuration adjusts frame clamping bounds, and several nodes add early return paths for zero-length waveforms.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: making audio processing nodes handle None inputs.
Description check ✅ Passed The description clearly relates to the changeset by explaining the context (GetVideoComponents returning None) and the solution (allowing None input to flow through audio processing nodes).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@comfy_extras/nodes_audio.py`:
- Line 418: The change allowing start_frame to be clamped to audio_length is
causing invalid ranges (start_frame can equal audio_length and thus start_frame
>= end_frame); restore the previous upper bound by clamping start_frame to
audio_length - 1 instead of audio_length (keep the lower bound at 0) so
start_frame remains a valid last index, and ensure end_frame logic (the code
that raises ValueError on lines ~423-424) will no longer be triggered for an
intended final-segment trim; update the min(...) call that sets start_frame
accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 685548f9-6887-451d-ba4d-5a011802e62b

📥 Commits

Reviewing files that changed from the base of the PR and between 74c17a2 and bfc5d50.

📒 Files selected for processing (1)
  • comfy_extras/nodes_audio.py

Comment thread comfy_extras/nodes_audio.py
Copy link
Copy Markdown
Member

@alexisrolland alexisrolland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and it's working fine.

Image

@alexisrolland alexisrolland merged commit 1f28908 into Comfy-Org:master May 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants