O'Reilly logo

Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets by Shawn Van Every

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Raw Audio Recording with AudioRecord

Aside from using an intent to launch the sound recorder and using the MediaRecorder, Android offers a third method to capture audio, using a class called AudioRecord. AudioRecord is the most flexible of the three methods in that it allows us access to the raw audio stream but has the least number of built-in capabilities, such as not automatically compressing the audio.

The basics for using AudioRecord are straightforward. We simply need to construct an object of type AudioRecord, passing in various configuration parameters.

The first value we'll need to specify is the audio source. The values for use here are the same as we used for the MediaRecorder and are defined in MediaRecorder.AudioSource. Essentially ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required