Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saturated audio with Stable Audio #4933

Open
Big-Onche opened this issue Sep 15, 2024 · 2 comments
Open

Saturated audio with Stable Audio #4933

Big-Onche opened this issue Sep 15, 2024 · 2 comments
Labels
Potential Bug User is reporting a bug. This should be tested.

Comments

@Big-Onche
Copy link

Big-Onche commented Sep 15, 2024

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

/

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

@Big-Onche Big-Onche added the Potential Bug User is reporting a bug. This should be tested. label Sep 15, 2024
@comfyanonymous
Copy link
Owner

56e8f5e

Does this fix it?

@Big-Onche
Copy link
Author

Big-Onche commented Sep 16, 2024

56e8f5e

Does this fix it?

It's better but there is still some clipping with that fix

@Big-Onche Big-Onche reopened this Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug User is reporting a bug. This should be tested.
Projects
None yet
Development

No branches or pull requests

2 participants