Hello everyone,
I am working on MacOSX, and on the android emulator.
I am trying to use AudioRecord, which put the recorded audio data into
a ByteBuffer. However this buffer is filled with 0 at the end of
recording.

Here is the code:


public class AudioAcquisition {

        private AudioRecord ar;
        private ByteBuffer bb;
        private int bufferSize = 200000;

        public AudioAcquisition() {
                bb = ByteBuffer.allocateDirect(bufferSize);
                ar = new AudioRecord(MediaRecorder.AudioSource.MIC, 8000,
                                AudioFormat.CHANNEL_CONFIGURATION_MONO,
                                AudioFormat.ENCODING_PCM_16BIT, bufferSize);
                ar.read(bb, bufferSize);
        }

        public void start() {
                bb.clear();
                ar.startRecording();
        }

        public void stop() {
                ar.stop();
                ar.release();
        }
}


Since I want to work on the audio data for signal processing, this
class seems promising. Could anyone help with it?

Thanks a lot!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to