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,
- Multiple MediaPlayer Songs playing at the same time
- Seek for MediaPlayer, also MediaPlayer seems to be missing Duration? (Useful for the loop point case above)
- Ability to set and get MediaPlayer’s pitch & pan, 3D space features
- 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.