audio file question

Skip to first unread message

Scott Baker

Nov 10, 2014, 12:39:55 AM11/10/14

I am new to Android and I am trying to build an app that can on-the fly play a sequences of sound clips (from res/raw).
I tried using soundpool, but there does not seem to be a way to tell it to wait for the first sound clip to finish before starting the second.
There is a callback available to wait for the load to complete, but there is no similar callback available to wait for the play to complete.
I suppose I could add a sleep, but that seems inelegant.

Another possibility would be to concatenate the sequences of sound clips into a single file prior to calling soundpool (.load then .play)
but I would not want to constantly write to the flash file system to do this (is there a way to do this in only RAM?)

Any suggestions to implement this?


C Shipley

Nov 11, 2014, 4:57:53 PM11/11/14
Don't think it can be done with SoundPool. Only two options I know of: use the MediaPlayer and a CompletionListener, or (a hack) use the MediaPlayer to get the duration of the sound file you're playing with SoundPool and start a timer that fires when the SoundPool is done.

I would probably just use the MediaPlayer.  Let me know if you need any help.

-- Curtis

You received this message because you are subscribed to the Google Groups "androidpdx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Reply all
Reply to author
0 new messages