WP8 music volume

Hi!

I have a problem with the music volume in my WP8 game. When putting volumes values less than 0.7 the music almost can’t be heard. I’ve estimated that 0.8 is 33% volume and 0.9 is 66%. It seems to sound well in 1.0f, although I have the feeling it’s sounding too low too.

Is there any known issue with WP8 volume? (Looking at the sources I think it’s more an issue from the OS rather than Monogame implementation, but I haven’t found anything related anywhere)

Thanks!
Kak

I’m having the same issue, using MediaPlayer to play songs. Does anyone know any workaround?

How is volume used on other platforms?
XNA says this:

Volume adjustment is based on a decibel, not multiplicative, scale. For example, when the
device volume is half of maximum (about 7 [this has been written in the old era with the 15 scale, now we have a 30 scale] in the Windows Phone user
interface), setting Volume to 0.6f or less is silent or nearly so, not volume 4
as you would expect from a multiplicative adjustment.
Setting Volume to 0.0 subtracts 96 dB from the volume. Setting Volume to 1.0 subtracts 0 dB from the volume. Values in between 0.0f and 1.0f subtract dB from the volume proportionally.
XNA Game Studio 4.0 Refresh | Microsoft Learn

MediaElement uses a linear scale, but our perception of volume is logarithmic, hence the volume setting has to be exponential. On WP8 a volume of 0.85 seems to refer to 50% volume. I assume this because MSDN says that the default volume is 0.5, except on WP where it’s 0.85 (and to my ears 0.85=50% volume seems to be correct).

Therefore a good approximation could be to use the 4th root of volume (0.5^(1/4)~0.84). I can submit a pull request for this on GitHub in case you want to test it without writing the code yourself :slight_smile:

1 Like

Excellent, that makes perfect sense. And seem to work great with 4th root in my initial tests. Case closed for me :slight_smile:

The fix has been merged into the develop branch of MonoGame on github, so feel free to grab that version and avoid having to do all the root calculation yourself :slight_smile:

1 Like

How could I decrease/increase the volume of my songs about 10% in MonoGame?
When I start my game, the value of the volume is 1.0f. I know that 0.1f is not 10% of the volume. But I have not understand how to calculate the correct value.

What is the easiest way to change the volume about 10%?

The issue I was refering when I posted this message was (kind of) fixed later in the repository.

So volume should work, approximately, as the XNA counterpart.

Yes, I found out that it works on iPhone too.