Audio features problem, more than 1 Song at a time, streaming & seeking sound effects?

Experimenting with audio, I compiled some Content with WAV audio both of type Song and SoundEffect.
After some tinkering I found out that Songs play through the MediaPlayer and you can have multiple SoundEffects, which you can make instances of, so you could apply 3D effects or loop them.

What I am having problems with is that I need my background music to be streamed, so I would naturally use MediaPlayer. However there are cases where I would need to crossfade between 2 background music tracks or have some lengthy ambience like crowds, birds, rain etc. playing along with the background music.
So that seems impossible to do, since only one MediaPlayer Song is allowed at a time, unless I use SoundEffect type for them all but that sounds like it would cost me more memory since SoundEffects are not streamed.
Additionally there seems not to be any ability to set/get the pitch and the pan of a Song or applying 3D Space effects to it. Which that limits use cases like hearing a muffled Song coming from inside a room located to the player’s left. Or speeding up the music, like how Sonic games alter the pitch of the Song when the player acquires a speedUp powerup.

A second issue is that I’d like to be able to seek the track position of a music file so I could have loop points. It seems possible with MediaPlayer but the limitation of having only one Song at a time creates an issue here. As far as I know you cannot seek SoundEffects in any way.

So basically I’d need,

  1. Multiple MediaPlayer Songs playing at the same time
  2. Seek for MediaPlayer, also MediaPlayer seems to be missing Duration? (Useful for the loop point case above)
  3. Ability to set and get MediaPlayer’s pitch & pan, 3D space features
  4. Seek play position & streamable option for SoundEffect types

To me it feels like MediaPlayer is outdated from the days that Android had issues with playing more than one audio stream.
Sound design is very important to me & I don’t want to be limited in such ways, unless I am missing something of course.

MonoGame implements part of the XACT API, but unlike in XNA it only supports in-memory playback :frowning: Audio support is definitely not great atm.

Regarding your points:

  1. Streaming multiple songs is not supported
  2. It looks like you can set the MediaPlayer.PlayPosition for seeking on Android and iOS and Song has a Duration property.
  3. Only supported through SoundEffect and XACT, i.e. no streaming
  4. Not supported

I really hope we can find some time to improve audio stuff. Right now, you might want to look at a third-party solution for audio in your game if you want to do stuff outside what’s supported.

I see, I wish it would be better as it is a very core component of a game and needs to be as flexible as possible.
Should I add a request on github?

Using an alternative third party library just gives me concerns about cross-platform (desktop/console/mobile/web)
First thing that comes to mind is fmod, which is what Unity also uses if I am correct, not sure what the limitations platform-wise & license are on that.

1 Like

Yes, please do. Can you open 3 separate issues?

  1. Multiple media player songs
  2. Seek for MediaPlayer (like I said before it looks like this is implemented for mobile, but that’s it)
  3. Streaming for XACT sounds

Alright, added :v: