Android devices are all about interactions. Interactions can come not only from touches and sensors, but also from audio input. Most Android devices provide a microphone to record sound and allow an application such as the Android desktop search to offer vocal features to record queries.
If the sound input is available, OpenSL ES gives native access to the sound recorder. It collaborates with a buffer queue to take data from the input device and fill an output sound buffer from it. The setup is pretty similar to what has been done with AudioPlayer
, except that data source and data sink are permuted.
To discover how recording works, record a sound when an application starts and play it when it has finished recording. Turning SoundManager
into a recorder can be done in four steps:
Using status
startSoundRecorder()
to initialize the sound recorder. Invoke it right afterstartSoundPlayer()
.With void
recordSound()
, start recording a...