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

Get Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.