-
Notifications
You must be signed in to change notification settings - Fork 271
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
Wav/WavStream audio crackling #183
Comments
Hi, I'm also playing Everything in my setup is pretty standard, I'm clueless about what could be causing the issue. |
This file has one of the OGG files that I tested, and a WAV file with the output of |
Some more info: I'm using a I would be surprised if that was the problem since any issues while reading the OGG would cause the loading to fail, but it does load and play, only with the crackling. Also, I'm compiling SoLoud along with my source code. Those are the SoLoud files I've added to the Makefile:
The only SoLoud-specific flag I'm passing to the compiler is Some more relevant information:
|
This was probably fixed by: b54020b because you said the crackling was in right channel only and that mono sources worked. Please reopen if this wasn't the case. |
Thanks for responding. I've pulled the latest code from the repository and the issue persists. |
Ah, I thought the problem was that there's weird crackling on the right channel, but now that I check your waves.. there's only sound on the right, and it's crackling.
I'd love to be able to reproduce the bug.. Can you compile and run sanity? (src/tools/sanity, link against soloud sources). Sanity doesn have a test to check if left or right channels are quiet, though, so it probably doesn't hit this specific issue, but at least if something pops up, we know it's a portability issue. |
Further elimination: since mono sources work, it's not about the 16 bit mix function. |
This produced a raw file that I could import into audacity and play fine:
|
I also tested the raw file converted to a wave by Audacity. In audacity the audio is correct, but the crackling persists in my application. I must be doing something wrong on my side, probably something in my audio backend. I use PhysicsFS, but I'm pretty sure I'd had a much bigger problem if it was messing up with the OGG reading. Sorry for the false positive. |
I still don't get it though; you said mono sources worked, and you recorded
off the mix function..
Fwiw, right channel seems to be the first one.
If you can figure out what was wrong, I'd love to hear about it; if you
find that the problem is on soloud's side, a minimal test source would be
nice.
…On Sat, Nov 10, 2018, 01:02 Andre Leiradella ***@***.*** wrote:
Closed #183 <#183>.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#183 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEQ_R15KY8K7suRBn6rEnVchn8aZSjtEks5utgmPgaJpZM4Uqf3N>
.
|
Ok, I've tried somethings and the cracks were always there:
The only time it worked was when I set the OGG volume to 1.0f, but then I don't know if it really worked or if the cracks were just inaudible. I've converted the OGG to raw using a minimal application using a volume of 0.2f and it worked. All source code was always compiled with the same compiler flags. I'm puzzled. If you have any other test that I can make please let me know. |
You say it worked when you set the ogg volume to 1.0f. What are you
normally setting it to?
…On Sat, Nov 10, 2018 at 1:30 PM Andre Leiradella ***@***.***> wrote:
Ok, I've tried somethings and the cracks were always there:
- I've dumped the raw buffer contents right after the call to the
mixing function
- Tried Stereo S16, stereo F32, mono S16
- No tampering with the samples
- I've zeroed the buffer before calling the mixing function
- Just in case
- I've used double buffering in my mixing function
- Maybe the code that was sending the samples to the hardware was
messing with the contents of the buffer
- Unlikely because it copies the samples to a different buffer
- I've used standard SoLoud IO by directly passing the path to the OGG
file on disk
- No PhysicsFS involved
- I've converted the OGG to WAV and used it in the application
- No OGG decoding involved
- I've removed all other sounds and let only the OGG playing
- No mixing of multiple voices
The only time it worked was when I set the OGG volume to 1.0f, but then I
don't know if it really worked or if the cracks were just inaudible. I've
converted the OGG to raw using a minimal application using a volume of 0.2f
and it worked.
All source code was always compiled with the same compiler flags.
I'm puzzled. If you have any other test that I can make please let me know.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEQ_R8v3toHs8Eei1KSC8mc8Sd5T7tvUks5utrjkgaJpZM4Uqf3N>
.
|
0.2f, but I dumped the OGG to WAV using this volume and the result was ok. |
Try enabling floating point debug to see if NaNs creep in somehow: define
FLOATING_POINT_DEBUG
…On Sat, Nov 10, 2018, 19:23 Andre Leiradella ***@***.*** wrote:
0.2f, but I dumped the OGG to WAV using this volume and the result was ok.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEQ_RzXUcnm2wVRffOli_yhLwWY8Ih-wks5utwuPgaJpZM4Uqf3N>
.
|
I had to change the code to use My application is a libretro core and I'm using RetroArch to run it, I can't easily fix the exception, nor compile my application to run without RetroArch. |
This starts to be a complete shot in the dark, but maybe libretro is
setting the fpu into some mode that causes soloud to generate NaNs in some
cases..
Does your compiler have options for floating point accuracy? As in fast vs
precise stuff. Those might be worth a try.
…On Sun, Nov 11, 2018 at 2:51 PM Andre Leiradella ***@***.***> wrote:
I had to change the code to use feenableexcept since I'm using Linux, but
then I got a FP exception on an unrelated code :(
My application is a libretro core and I'm using RetroArch to run it, I
can't easily fix the exception, nor compile my application to run without
RetroArch.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEQ_R7jR0ppO8bYY7E4-YKmLClolx9U2ks5uuB1jgaJpZM4Uqf3N>
.
|
Peace, I'm facing a mostly same problem: using Null driver So I compiled with FLOATING_POINT_DEBUG on Windows x64 and ran it again, but nothing new happened. |
Any chance you could zip up the whole project with visual studio project so
I could see if it happens here too? The winning combination seems to be
libretro + soloud null driver..
…On Sun, Nov 11, 2018 at 6:08 PM lamelizard ***@***.***> wrote:
Peace, I'm facing a mostly same problem:
using Null driver
in a libretro core
using mix() (not the 16bit version)
the right channel crackles (I manually switched the channels in between
soloud and retroarch -> it's the right soloud channel that crackles)
So I compiled with FLOATING_POINT_DEBUG on Windows x64 and ran it again,
but nothing new happened.
But I don't know what should have happened, does nothing mean that there
are no NANs?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEQ_R1F_tIpKjx_VaT7Y5E2JPVj9FjrIks5uuEtlgaJpZM4Uqf3N>
.
|
Yeah, I'm out of ideas too.
Unlikely. I've had trouble in the past with DirectX changing the FP rounding mode, but I'm on linux with OpenGL.
It does, but I don't really think it could be the reason of the cracks. @lamelizard if you dump raw samples right after |
This is one ping-pong open-close issue but I want to see how deep this rabbit hole goes.. |
Again, if either of you can either zip me up the project or give me instructions how to build one myself, I'd appreciate it.. |
Yes, I'm removing my WAV/OGG audio mixer in favor of SoLoud.
I'm not sure how to make it compile with MSVC. The code doesn't have anything platform dependent: https://github.com/leiradel/retroluxury There's a Makefile in the The
You have to have RetroArch installed to run the core:
Running this from inside Visual Studio or attaching to the process should let you debug the mixer, which is called from within Let me know if I can help further. |
Got it compiled and running under visual studio. There's definitely some noise on the right channel, but the left channel isn't quiet.. anyway, this is something I can look at. |
Righty-o. |
I'm waiting for confirmation before closing this, even though that was a pretty clear bug. |
Ah yes, the core runs at 60 FPS and sets the audio output to 44100 Hz, so it wants 735 stereo samples per video frame. Thanks so much for looking into this, I'll test the fix later and will let you know. |
fwiw for visual studio build, I dumped all the source files to a visual studio project, set up paths, removed all restrict keywords, added dllexport declspecs to all of the libretro functions, and the thing compiled. Didn't get the zip files to work but using a direct directory did. |
I confirm the fix works for me, thanks again. |
Thanks. |
Perfect audio.
Audio crackling, right channel only.
Load a WAV or OGG using either
Wav
orWavStream
, start playing and mixing. It's easier to hear the crackling with a low volume for the voice.I'm using the null backend to mix the sound to use in a libretro core. I've just integrated SoLoud, before I was using my own audio mixer with WAV and OGG support only and the mixing was ok. I was using stb_vorbis too, but it doesn't seem to be related to it wince WAV files also present the issue.
The text was updated successfully, but these errors were encountered: