LibGDX audio not loud enough

Perhaps I haven’t looked into audio using libGDX or OpenAL enough, but I feel like this should have a simple solution. When playing sounds using both the Sound and Music classes, the output is far too quiet. The volume is by default set to 1, and increasing it beyond that value does not make it louder. (which makes sense, since the volume is intended to be between 0 and 1)

When I compare the volume of a maxed libGDX Sound or Music to the volume to a Youtube video, or an audio clip played through banshee (I am using Linux), libGDX is much quieter.

Playing sounds natively in Java works at the volumes I’d expect, but I’d rather stick to the LibGDX library as to reduce the number of dependencies on external libraries.

Is there any way, within the confines of LibGDX, to increase the global volume? I’m a little tired of increasing the volume of my computer when testing my game, then having to decrease it whenever I watch a video. I’m aware I could just decrease the volume of Youtube videos, but that only applies to Youtube! What about some other application?

I load my music and sounds via an AssetManager like this.


AssetManager manager = new AssetManager();
manager.load("mymusic.ogg", Music.class);
manager.finishLoading();
Music music = manager.get("mymusic.ogg");
music.play();

Any reason why this would result in a volume quieter than other applications?

Just set your browser’s volume to be lower than your game’s in the volume mixer. Usually the mixer will remember your application and its volume (I do this exact thing, my game is too loud usually so I have it at half volume).

I thought I made it clear that that was not a viable solution for me… I already said that I’d rather not turn down the volume of every other application so that MY application sounds reasonable.

If this is such a problem, use an audio editor like Audacity to amplify all the music and sound effects so your game sounds reasonable. It’s better for a game to be louder than quieter because you can turn it down but not up.

Funnily enough, the same audio file plays louder in Audacity than it plays in LibGDX. Amplifying the music would just clip the sound, which doesn’t work out in anyone’s favor.

Yes. From what has been written here, it sounds more like the issue is the level that LibGDX uses for playback than one concerning the assets themselves. Audacity is really great for easily amplifying assets to the maximum volume just short of clipping. Some audio systems are more conservative than others in terms of how much volume they allow. LibGDX must be on the low side. I’ve not heard of similar problems with TinySound, but it doesn’t attempt to run on as many platforms as LibGDX, and doesn’t have any special support for 3D audio. (Does LibGDX support 3D audio?)

The source for LibGDX is available, though. I remember looking through it a couple years ago, and being annoyed at how they coded stereo/mono parameter as a boolean or int and with a slightly confusing name. At least that is what is left of my memory of my general experience code reading the audio portion.

Still, if you are willing to open up a copy (isn’t it on github or somewhere like that? I used to have a fork) it is likely very possible to tweak things to raise the volume without causing other problems.

Afraid not. I am actually pretty inexperienced in using git-anything. Only ever used Github’s desktop gui last semester for a software development class. I’m guessing that I’ll have to sift through some LibGdx source code if I want the global volume raised. Meh…

Libgdx has pan support and that’s about it. If you use the AL backends you can make it 3D sound.

There isn’t exactly a master volume setting as it just uses the gain function in AL to change the volume. Gain in OpenAL is a value between 0 and 1, (which is relative to the constant AL_MAX_GAIN which is normally 1 if I recall).

If you’d actually want to amplify sounds, you’d have to get the PCB data of the sound, actually edit it yourself, and play it back again using AudioDevice.

That’s useful info!

So, I’d check that the values used for playback are actually set to 1, and if needed, tweak the AL_MAX_GAIN if it is reachable. From what the OP has stated (that Audacity plays the audio at a high volume), chances are that PCM data is already as high as it can be without clipping. But there is a lingering doubt in my mind–it seems to me that this would have come up before if there was a big difference between playback via LibGDX and other DAWs or sound systems. That (to me) adds to the likelihood that the values being sent to AL are somehow not 100%, and that the issue may be specific to the OP’s game.

How much work to test the following: load and play the same assets using TinySound and compare playback volumes. Not sure if that is useful or not.