Pan/Stereo does not work at all for SoundInstances or SoundEffects

Basically title.

I want my Sound to come from either the right or the left side, depending on where it is created.

For that I can use the Pan property, which is defined as a float from -1 (left) to 1 (right).

Or so I thought.

Art.SoundGunShot.Play(0.05f, 0f, 1f);

is no different than

Art.SoundGunShot.Play(0.05f, 0f, -1f);

  • both play at the same volume on both speakers. I know it’s not a windows configuration / hardware thing, I have stereo sound in all other relevant applications.

Any ideas?

Monogame 3.6.0.182 and DirectX build for windows.

I think, this problem is have since the beginning of the MonoGame. But my memories, if you load an existing stereo sound, and you touch in any way the Pan parameter, it immediately switches to mono, but I tried it a long time ago.

You can try to create two pieces of stereo sound. The point is that you need a proper sound editing software. The sound one, you need to change of the Pan value to the left side, and the sound two to the right side. In the end you have two stereo sound the same, but one is hear on just the left side, and the other just to the right side. Then you need to load this two sound into MonoGame, playing at the same time, and Volume values trick is to get the right stereo widening reach.
And do not use the extended play(…) method, because if you setting the Pan parameter, your stereo sound is forcibly closed to center (mono).
You just set the sounds parameters without Pan from multi line:

yourSound.Pitch = …;
yourSound.Volume = …;
YourSound.Play();

thanks for your answer but that is horrible if true :frowning:

I 100% agree, sounds are unfortunately under-considered in game dev (see how much visual tutorial are available for shaders, 3D and visuals, compare to sound tutorials) despite being as much as important (try a game without sound, one with only music, one with full sound, it’s obvious).

Just a heads up, the problem was that the sounds were not in mono. It works as intended now.

Converting them from stereo to mono is a solution I didn’t think of back then.

I think a PR was merged that does this conversion for you when you apply panning. Not entirely sure if that was about this though

I’m thinking it might have been for the 3d audio API, not just panning.