- Clarify that global patch solves TWO issues: TorchCodec DLL + int16 normalization
- Explain timing criticality: patch must apply before torchaudio import
- Remove redundant pytorch_patches call from apply_all_compatibility_patches()
- Update save_audio_safe docstring to explain defense-in-depth approach
- Add detailed docstring to pytorch_patches explaining both issues and fixes
Recreate pytorch_patches.py with proper global monkey-patching of torchaudio.save/load
to use scipy.io.wavfile instead of TorchCodec. This fixes 'Could not load libtorchcodec'
errors on Windows with PyTorch 2.9.0+cu128 without needing fixes in every file.
Changes:
- Global monkey-patch applied at startup via comfyui_compatibility.py
- Works for ALL code that uses torchaudio.save/load (recorder, voice changer, etc)
- No user setup required, no FFmpeg workarounds needed
- Pure Python scipy solution, no native dependencies
This is the proper fix for TorchCodec Windows incompatibility with PyTorch 2.9.