Comfy-Org / Comfy-Org/ComfyUI

Saturated audio with Stable Audio

Open
#4,933 2 comments 2 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Expected Behavior

A clear sound!

### Actual Behavior

Music or loud sound effects made with Stable Audio are heavily saturated.

### Steps to Reproduce

I tried with every sampler, scheduler, and CFG possible, the issue is still there but **I found a way to fix it.**

### Debug Logs

```powershell
/
```

### Other

In nodes_audio.py in the class VAEDecodeAudio.

We should normalize the audio when decoding by adding these lines or something similar:
max_amplitude = torch.max(torch.abs(audio))
if max_amplitude > 1.0:
audio = audio / max_amplitude

This fixes the audio clipping

![audiodebug](https://github.com/user-attachments/assets/0a2a33b6-345d-40ae-bd96-d876677a982f)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.