Sounds overlapping when playing too many at the same time

I am pretty novice when it comes to game sound management, so excuse my ignorance.

I am having an issue when playing too many sounds at the same time where some sounds stop playing, or doesn't play at all, almost like some sounds overlap others. I've read some about the sounds using individual buffers and that there should be no problem playing these at the same time at runtime. When I only had a small ammount of sounds in the game, it all worked flawlessly. My SoundManager had no problem playing multiple sounds at the same time ( I loaded the sound to memory when I was going to play it and disposed it when it was done playing, approx. 5 seconds).

My SoundManager Class

I've recorded a video to better illustrate what this sound problem is. As you can hear in the video below, the attacking sounds can only be heard at some points, as for some enemy sounds. The idling sounds of the enemies (breathing and bat sounds) seem to work without issues, though.

Video

Thank you for helping, because I have no clue how to fix this issue. Is there something that I've left out in my SoundManager?

• Maybe you have hit this wall: "The current upper limit for decoded audio is 1 MB." Also, when I worked on the audio of a project, I realized that there was a maximum number of concurrent sounds that could be played at the same time (I think they called it "channel"). It was in c++, on windows and involved OpenAL, so it might not apply to your situation. You should try to do a very small application to do just that: test the limitations of libgdx sound engine! – Vaillancourt Jul 31 '15 at 11:59
• Thank you for the tip! I've noticed that some audio files for the enemies was in fact over 1 MB in size, so I encoded the files from wav to mp3, decreasing the file sizes to under 500kb, is this the right way to go? – Henrik Söderlund Jul 31 '15 at 12:40
• IMHO the important part here is decoded audio: event if your encode it in mp3, it will have to be decoded before being played. I'm not familiar with libgdx, but it seems there could be a bit more information with the doc I read. You could try and get a few more effects in by changing the 5 seconds hard coded value to something specific to the sound (e.g. your Manager is aware of all the sounds and their duration, or you could pass in a duration for the timeout as a playSoundEffect parameter). You could also try to reduce the quality (sampling rate, stereo -> mono) to save space. – Vaillancourt Jul 31 '15 at 12:57
• Okay, thank you. I just stumbled upon this tutorial: link where he uses a so called LRUCache to save up memory usage, I will try it out and report back the results. – Henrik Söderlund Jul 31 '15 at 14:05