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. data communication between emulator and localhost

i want to communicate data between localhost( as server) and emulator
(as client).

server program is written using java and its running on the java

Client program is written using android.we use below code for the

try {

           InetAddress serverAddr = InetAddress.getByName

           Log.d("TCP", "C: Connecting...");
           Socket socket = new Socket(serverAddr, 8080);
           String message = "Hello from Client";
               try {
                Log.d("TCP", "C: Sending: '" + message + "'");
                PrintWriter out = new PrintWriter( new BufferedWriter
( new OutputStreamWriter(socket.getOutputStream())),true);

                Log.d("TCP", "C: Sent.");
                  Log.d("TCP", "C: Done.");

             } catch(Exception e) {
                 Log.e("TCP", "S: Error", e);
                } finally {
         } catch (Exception e) {
              Log.e("TCP", "C: Error", e);

But it shows below error.

11-12 09:11:37.647: DEBUG/TCP(234): C: Connecting...
11-12 09:11:37.647: ERROR/OSNetworkSystem(234): unknown socket error
11-12 09:11:37.678: ERROR/TCP(234): C: Error
11-12 09:11:37.678: ERROR/TCP(234): unknown
11-12 09:11:37.678: ERROR/TCP(234):     at
(Native Method)
11-12 09:11:37.678: ERROR/TCP(234):     at
11-12 09:11:37.678: ERROR/TCP(234):     at
11-12 09:11:37.678: ERROR/TCP(234):     at
11-12 09:11:37.678: ERROR/TCP(234):     at<init>
11-12 09:11:37.678: ERROR/TCP(234):     at
11-12 09:11:37.678: ERROR/TCP(234):     at
11-12 09:11:37.916: INFO/ActivityManager(50): Displayed activity 913 ms
11-12 09:11:37.968: INFO/ARMAssembler(50): generated
scanline__00000077:03545404_00000A04_00000000 [ 29 ipp] (51 ins) at
[0x23f4c0:0x23f58c] in 7832686 ns
11-12 09:11:43.007: DEBUG/dalvikvm(89): GC freed 2452 objects / 123016
bytes in 78ms


2. Installing Android on an LG KU990

Hi Everyone,

I'll be honest - I'm a complete beginner when it comes to mobile
operating systems, especially replacing OEM standard OSs with open-
source options.  With that being said, I am highly interested in the
possibility of loading Android onto my LG KU990 ("Viewty") mobile
phone, and I have some questions for all of you regarding this

Well, first of all, I'll start with the basics.  I am on SFR in
Paris.  Would Android be able to utilize their GSM network?  Would I
be able to send SMS messages and make phone calls through their

Secondly, the KU990 is a touchscreen phone.  I know that Android
supports touch screens, but would it require any specific modification
or drivers to be installed with it?

How exactly would I go about installing the OS onto my phone?  Through
the USB cable?  Does Android come with a PC client for management of
the device?

At the moment, a google search doesn't seem to bring up any instances
of people having installed Android on their KU990.  With that being
said, I've only performed a cursory search.

I appreciate any and all help that you experts can offer.  I know that
my questions are probably pretty dumb, but I've been wondering about
them for a while!




3. AW: data communication between emulator and localhost

4. Diggin Mobile

5. find text in page

6. Drawing a circle outline? (not a filled circle)

7. XMas presents