Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (744)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (825)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  LibGDX audio not loud enough  (Read 6677 times)
0 Members and 1 Guest are viewing this topic.
Offline DrewLols

Senior Devvie


Medals: 4
Projects: 1


Noob going through metamorphosis...


« Posted 2016-03-17 20:19:36 »

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.

1  
2  
3  
4  
5  
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?

Did you know that 90% of statistics are wrong?
Offline chrislo27
« Reply #1 - Posted 2016-03-17 23:05:13 »

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).
Offline DrewLols

Senior Devvie


Medals: 4
Projects: 1


Noob going through metamorphosis...


« Reply #2 - Posted 2016-03-18 20:41:31 »

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.

Did you know that 90% of statistics are wrong?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline chrislo27
« Reply #3 - Posted 2016-03-18 21:33:08 »

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.
Offline DrewLols

Senior Devvie


Medals: 4
Projects: 1


Noob going through metamorphosis...


« Reply #4 - Posted 2016-03-23 20:58:05 »

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.

Did you know that 90% of statistics are wrong?
Offline philfrei
« Reply #5 - Posted 2016-03-23 22:46:12 »

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.

music and music apps: http://adonax.com
Offline DrewLols

Senior Devvie


Medals: 4
Projects: 1


Noob going through metamorphosis...


« Reply #6 - Posted 2016-03-24 02:59:15 »

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...

Did you know that 90% of statistics are wrong?
Offline chrislo27
« Reply #7 - Posted 2016-03-24 03:20:45 »

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.
Offline philfrei
« Reply #8 - Posted 2016-03-24 21:58:26 »

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.

music and music apps: http://adonax.com
Pages: [1]
  ignore  |  Print  
 
 

 
Ecumene (150 views)
2017-09-30 02:57:34

theagentd (225 views)
2017-09-26 18:23:31

cybrmynd (306 views)
2017-08-02 12:28:51

cybrmynd (291 views)
2017-08-02 12:19:43

cybrmynd (302 views)
2017-08-02 12:18:09

Sralse (293 views)
2017-07-25 17:13:48

Archive (980 views)
2017-04-27 17:45:51

buddyBro (1109 views)
2017-04-05 03:38:00

CopyableCougar4 (1686 views)
2017-03-24 15:39:42

theagentd (1435 views)
2017-03-24 15:32:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!