Question

I've been trying to make multiple sounds work simultaneously but I kept getting errors like Sample not ready and Error creating AudioTrack. Though I've taken care of the first error, the other error persists.

I'm using two mp3 files, that are away above 5 mb(>4 minutes) and thus was wondering if SoundPool is the right way to go about it? I can use Media Manager but it doesn't let me play multiple files simultaneously.

Was it helpful?

Solution

SoundPool is recommended for <1MB sound clips, so I'd use MediaPlayer in your case. You can call the following for each sound and they will play simultaneously:

MediaPlayer.create(YourActivity.this, R.raw.your_sound).start();

Or you can create multiple MediaPlayer objects and play a sound on each, then release() them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top