-
Notifications
You must be signed in to change notification settings - Fork 107
Audio artefacts #1142
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
Comments
Thanks for the investigation! This must be a miscompilation caused by one of the optimizations then. I will see if I can narrow down which optimization is responsible. |
By the way, which license is the repro? |
Interestingly, when I use a simple sin wave as a source, I get normal sounding results! I wonder if it comes from the vorbis decoder, I'll try the mp3 decoder. |
Added the Unlicense LICENCE :-) |
Thanks. I won't have to worry about adding a test derived from it to cg_clif then. |
I confirm that using the mp3 decoder gives normal result. It probably comes from the vorbis decoder used by rodio: lewton. |
Adding [profile.dev.package.lewton]
opt-level = 0 does solve the artefacts issues [profile.dev.package.lewton]
opt-level = 1 still gives artefacts. Also, generating a sin wave ogg file gives normal result (maybe it compresses well and does not go through a miscompiled zone ?) |
I am able to reproduce the issue. Disabling my stack2reg optimization fixes it. I already kind of suspected this to be the culprit, as I wrote it with absolutely zero knowledge about how to write this kind of optimization. I will see if I can fix it and otherwise I will just disable it completely. |
Disabling just the the dead store removal of that optimization fixes it too. |
I have disabled stack2reg. Maybe I will try to fix it in the future. |
This is the official issue for the audio artefacts I had in #1129
I tried to reproduce the problem, however I hit an incredibly weird bug.
When compiling this snippet alone
everything works fine and the music sounds good.
However when I compile the exact same main with the exact same audio file in my big project with lots of dependencies, there are hugs artefacts which look like this in audacity: Top is what is output and bottom is expected.

I tried deleting the target folder and rebuilding and I still got the artefacts.
Then I found that by removing theses directives about optimizing in my workspace Cargo.toml
the audio artefacts were gone !
However, when reenabling
the artefacts came back.
So I started removing dependencies, and I found that, basically, enabling optimizations on rodio using cg_clif gave thoses artefacts..
You can find a repo to reproduce here.
https://github.com/Uriopass/cranelift_bug
EDIT:
Now that I think about it, you still have to dive a bit further, it's not like there's no dependencies. I'll try on cpal examples.
The text was updated successfully, but these errors were encountered: