Page 1 of 1

Audio corruption

PostPosted: Sat Feb 09, 2019 5:06 am
by Ian
I know this has been talked about for years .. but most of the time I test with sound disabled it makes no sense unless you are hitting 60fps.

In debug mode, in visual studio the sound is perfect. Well it sounds as it should. But this is what the release build sounds like when compiled in visual studio 2017 ..

https://www.youtube.com/watch?v=mcinDcGD6GA

The audio is absolutely destroyed. I don't think the compiler is at fault here.. My best guess is there are some kind of illegal memory writes happening, and it's not an issue in debug mode due to extra memory padding. Could be that or some variable initialisation issue ..

Re: Audio corruption

PostPosted: Sat Feb 09, 2019 1:57 pm
by model123
Hello Developers

I load the project into Visual Studio 2017 community
Update the platform tool to v141
Building solutions or supermodel with release x64

The sound is not broken

Google Translation

Re: Audio corruption

PostPosted: Sat Feb 09, 2019 8:45 pm
by Bart
Also works fine with gcc. Does MSVC support linking debug and release modules? We could probably zero in on the offending code through a process of elimination. My money is on either the archaic MPEG decoder or the SCSP code.

We could probably run it through an address sanitizer, too, but I'm not sure if a sufficiently new version of gcc is available for Windows and I no longer have access to Linux systems.

Re: Audio corruption

PostPosted: Sun Feb 10, 2019 5:39 am
by Ian
Does MSVC support linking debug and release modules?

I'm not sure. But virtua fighter sounds fine, except a little extra reverb which probably shouldn't be there. I think its just the mp2 decoding

Re: Audio corruption

PostPosted: Sun Feb 10, 2019 1:57 pm
by Bart
If there is a newer, GPL-compatible MPEG decoder we should probably swap it out (although it might not be too hard to identify the really gross parts of this one and fix them -- I think gcc produces a lot of compiler warnings that could be investigated). Does MAME have one? For years, they couldn't do MPEG music do to patent issues but I think the MPEG patents may have expired by now.

Re: Audio corruption

PostPosted: Sun Feb 10, 2019 5:34 pm
by Ian
something like this ?
https://github.com/lieff/minimp3

Seems almost impossible to find any decent decoders that only decode mp2 for a possibly smaller implementation.

There is this one ..
https://keyj.emphy.de/kjmp2/

But at the bottom

Hi KeyJ, I tried using your library and it’s really simple to use and integrate.

But I’ve run into an issue regarding playback quality. On a sample sound I use, the decoder produces audible artifacts. This is visible both with the mp2play.exe and when decoding internally within my program.


and his reply

Coder: Yes, kjmp2 is very noisy – the SNR may be as low as 20 dB. I’m not sure whether this is strictly a result of its simplicity – it might just be that I have a bug somewhere or my fixed-point computations are sub-optimal. Also, there’s no noise shaping of any kind.


So probably not a good implementation to use