ENIGMA introduces clipping into .ogg audio

Reporter: zulc22  |  Status: open  |  Last Modified: November 18, 2020, 07:42:46 PM

Describe the bug

ENIGMA introduces clipping into .ogg audio when the file itself has none.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Compile this example project and run it.
    enigmabugreport.zip

Expected behavior

The audio is expected to not clip.

RobertBColton  
Ehhh, I saved it out and I think it sounds more like staticy noise than clipping inside the game. It could be the OGG decoder we are linking to OpenAL soft and thus a MinGW bug. Using the play function instead of loop doesn't fix it. Also, it's just as reproducible if I manually load it in, so it's not the asset pipeline at fault.

sound_loop(sound_add("C:/Users/Owner/Desktop/idk.ogg",0,0));

RobertBColton  

Ok, I did some more deep investigating of the issue. I really don't see anything out of place with how we are playing the sounds. I even tried playing around a bit with source properties, to make sure they were the defaults. I tried looking at all the dependencies, and to see if there's any issues reported online against the libs, and only discovered I can still play OGG after removing libogg from the Makefile for some reason. Maybe @fundies or @time-killer-games could shed some light on that for me, but I digress.

The main big piece of information I found here is heavy indication this is a WINE bug. MinGW gets a lot of its headers and stuff from WINE (DirectSound for sure) but I am not certain about OpenAL soft. Regardless, I know GameMaker is using OpenAL and on a similar sounding issue posted against OpenAL soft I noticed a game mentioned called Hyper Light Drifter. That immediately struck me as familiar, because it is actually a GameMaker made game.
kcat/openal-soft#226

The reason this wouldn't repro in GMSv1.4 I presume is because YoYo did something recently with respect to linking OpenAL to avoid MP3 licensing concerns or something to that effect. I'm not entirely sure this is the issue, but it definitely seems to fit the bill, until somebody finds out more about this.

JoshDreamland  

Are you not able to reproduce the problem on your machine, Robert? AFAIK this is a problem with the sample size we're using. I think we're using 8 bit samples for our PCM data, so audio files with high volume are being clipped at 255. I can't imagine that being local to one machine.
RobertBColton  

@JoshDreamland yeah I can, as I said, it's static. But we are using alure to load the sounds (unlike GM) which configures the format for us. I was looking at the docs for OpenAL about how to configure it on the buffer after the fact though. I'll have to do deeper testing then and try manually loading the audio in ENIGMA without alure.

@zulc22 Could you please also file an issue on OpenAL soft if you know how? If not, could you give me permission to use your ogg file? The reason I ask is because I can't seem to repro it with other OGG files (even higher quality ones that fit Josh's description). If you give me permission, I'm a bit busy, but I can get around to writing a self contained OpenAL soft + Alure example for them which should make it easier for them to help figure it out. Also it would help if you could clarify if you are on Windows or Linux.

zulc22  

@RobertBColton i did this on arch linux; and yes you have permission from me to use that .ogg file
zulc22  

i think i encoded the ogg with either ffmpeg or fluidsynth. not quite sure. i'm on windows now so i can't do that much testing on the linux side
zulc22  

and i wasn't cross-compiling or anything; this was a native linux compile and run.
RobertBColton  

Oh, that's interesting, I thought you were on Windows. That's weird I get what sounds like noise when the song gets above a certain decibels over on Windows 10. Anyway, thanks, when I can, I'll try to submit the OGG with a working example to OpenAL soft. In the interim, you could also try switching out your pulse audio/driver too and upgrading OpenAL.
Please sign in to post comments, or you can view this issue on GitHub.