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
AudioTrack.

--~--~---------~--~----~------------~-------~--~----~



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.




--~--~---------~--~----~------------~-------~--~----~