Skip to content

Remove Python audio I/O — pass native WAV/MP3 directly to/from acestep.cpp#14

Merged
lmangani merged 5 commits intomainfrom
copilot/fix-output-stage-import-error
Mar 14, 2026
Merged

Remove Python audio I/O — pass native WAV/MP3 directly to/from acestep.cpp#14
lmangani merged 5 commits intomainfrom
copilot/fix-output-stage-import-error

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

The node was unnecessarily converting audio through Python tensor pipelines on both input and output. acestep.cpp reads and writes WAV/MP3 natively, so all Python audio decoding/encoding is dead weight.

Input (src_audio)

  • Removed src_audio_input (AUDIO connection) and the torchaudio.save() conversion block that serialised a ComfyUI tensor back to WAV for the binary to re-read
  • Removed import torchaudio
  • src_audio STRING widget remains — users provide a file path; the binary reads it as-is

Output

  • AcestepCPPGenerate is a terminal OUTPUT_NODE (RETURN_TYPES = ()) — the binary's native MP3/WAV is copied to ComfyUI's output directory via shutil.copy2 and {"ui": {"audio": [...]}} is returned so ComfyUI renders an inline player on the node
  • Fixed stale class docstring that still claimed "returns a ComfyUI AUDIO tensor"

Workflows

  • Removed src_audio_input slot from all four workflow JSONs
  • Removed LoadAudio node and AUDIO link from cover and reference-audio workflows

Tests

  • Added TestNoPythonAudioProcessing class that scans nodes.py for top-level imports of torchaudio, torch, wave, numpy, soundfile, pydub and fails if any are found
  • Added assertions that src_audio_input is absent from INPUT_TYPES and RETURN_TYPES == ()

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…endency

Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ImportError at output stage due to missing TorchCodec Fix output stage crash: replace torchaudio.load with ffmpeg+wave to avoid torchcodec Mar 14, 2026
Copilot AI requested a review from lmangani March 14, 2026 15:59
…e MP3/WAV via shutil

Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
Copilot AI changed the title Fix output stage crash: replace torchaudio.load with ffmpeg+wave to avoid torchcodec AcestepCPPGenerate: eliminate all audio decoding on output — copy native MP3/WAV directly Mar 14, 2026
Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
Copilot AI changed the title AcestepCPPGenerate: eliminate all audio decoding on output — copy native MP3/WAV directly Remove all Python audio I/O — pass native MP3/WAV files directly to acestep.cpp Mar 14, 2026
…o decoding

Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
Copilot AI changed the title Remove all Python audio I/O — pass native MP3/WAV files directly to acestep.cpp Remove Python audio I/O — pass native WAV/MP3 directly to/from acestep.cpp Mar 14, 2026
@lmangani lmangani marked this pull request as ready for review March 14, 2026 16:53
@lmangani lmangani merged commit 769a911 into main Mar 14, 2026
2 checks passed
Copilot AI added a commit that referenced this pull request Mar 14, 2026
…eAudio nodes work

PR #14 set RETURN_TYPES=() on AcestepCPPGenerate, removing the audio
output slot entirely. Any workflow with a PreviewAudio node connected
to slot 0 failed with "tuple index out of range" because RETURN_TYPES[0]
did not exist.

- nodes.py: RETURN_TYPES=("AUDIO",) + RETURN_NAMES=("audio",); lazy-
  import torchaudio inside generate() after writing the output file so
  the waveform is returned as {"result": (audio,), "ui": {...}}, giving
  both an inline player on the node and a proper AUDIO connection for
  downstream PreviewAudio / SaveAudio nodes.
- tests/test_nodes.py: update RETURN_TYPES assertions to ("AUDIO",);
  fix TestNoPythonAudioProcessing import scan to flag only true module-
  level (non-indented) imports; replace test_generate_return_types_empty
  with test_generate_has_audio_output.
- tests/test_workflows.py: replace tests that asserted no PreviewAudio /
  no output links with tests that assert PreviewAudio IS present and the
  AUDIO output IS connected.
- workflow-examples/*.json: add a PreviewAudio node wired to the AUDIO
  output of AcestepCPPGenerate in all four example workflows.

Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
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