O'Reilly logo

Flash Development for Android Cookbook by Joseph Labrecque

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

Recording Microphone Audio Sample Data

One of the most fundamental things a developer would want to be able to do with audio sample data gathered from an Android microphone, would be to capture the data and use it in some way within an application. This recipe will demonstrate how to preserve and play back captured microphone audio sample data.

How to do it...

We will employ an event listener to respond to sample data reported through the Microphone API by writing captured audio data to a ByteArray and then playing it back internally through the Sound object:

  1. First, import the following classes into your project:
    import flash.display.Sprite; import flash.display.Stage; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.SampleDataEvent; ...

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