SoundEffect panning does not split properly

I’m working on a MonoGame project where, when a weapon is fired, a bullet’s sound effect is supposed to play, with the audio panned depending on the starting position of the bullet.

The docs say that the pan value ranges from -1.0f to 1.0f, but audio is only playing out of the left speaker, right speaker, or equally balanced. pan = 0.1f is being treated the same as pan = 1.0f. This behaved as expected when using the SharpDX library, but not after we moved to OpenGL.

This is the function we wrote to play the audio.

public static void PlaySound(string name, float vol = 0.5f, float pan = 0.0f, bool jitter = false)
{
    bool ok = SFX.TryGetValue(name, out SoundEffect audio);
    if (ok)
    {
        float pitch = jitter ? ((float)Utils.Random.NextDouble() / 4.0f) : 0.0f;
        audio.Play(vol, pitch, pan);
    }
}

This is an x-post from https://stackoverflow.com/questions/53271206/monogame-audio-panning-restricted-to-100-left-100-right-or-50-50. Any help would be appreciated!

Hey @Brendan! What version of MonoGame are you using?

Running MonoGame 3.7. The OpenGL NuGet package is version 3.7.0.1708.

I thought this might have gotten fixed, but I guess not :frowning:
Can you open an issue on GitHub so we can track this? https://github.com/MonoGame/MonoGame/issues

I’ll go open an issue now. Thanks!

Edit: https://github.com/MonoGame/MonoGame/issues/6543

1 Like