Playing sound from memory

by rookie1_1998 » Tue, 28 Apr 2009 11:03:24 GMT

Sponsored Links
 I need a way to play a short sound clip repeatedly very fast, with
precise timing for musical purpose.  I looked around, and it seems
like MediaPlayer and SoundPool don't guarantee lag-free playing.  Is
there anyway I could load the sound to memory myself and play from
memory (edit the stream)?

I know in Java I can do something with ByteArrayInputStream but so far
I couldn't find any way to do this in Android...


Playing sound from memory

by niko20 » Tue, 28 Apr 2009 19:17:34 GMT

 Hi, You can use the AudioTrack class to stream raw PCM data.


Sponsored Links

Playing sound from memory

by Marco Nelissen » Tue, 28 Apr 2009 23:28:00 GMT

 On Mon, Apr 27, 2009 at 5:50 PM, rookie1_1998

That's what SoundPool does: it loads the sound in to memory.
If you really want to copy the bytes yourself, then you should use


Playing sound from memory

by Dave Sparks » Wed, 29 Apr 2009 09:07:16 GMT

 SoundPool has too much jitter for a serious music application. If you
want to control the jitter, you need to output to a single AudioTrack.


Other Threads

1. Snake on Image

Hi Folks,
   I am new here. I need to add a background image of the Snake sample game.
I could change the color by adding

android:background="#ffffffff" as shown below

 <FrameLayout xmlns:android=""

'A Problem is first solved in the mind and then on paper'

Thanks & Regards,


2. How to make a Button repeat


Pretty new to Android, I am just wondering how to make a button

For example, if I touch and hold the button down, I would like an
event to fire for the initial 'down' then, preferably after a little
delay, I would like to get further 'down' or 'still down' events.

The behavior I am after is much like the +/- buttons on the date
widget in the API Demos - Views - Date Widget activities... press and
hold the +, you get an initial increment, then after a short delay, it
continues to increment.



3. Decoding High resolution pics

4. Adb shell escape character

5. Android online training or training in Bangalore

6. MyLocationOverlay blocks my Activity

7. Failed to find an AVD compatible with target 'Android 1.5'. Launch aborted. Error