Audio Recording
Android Quick Start
Platforms
- Android (5.0+, API 21+)
Requirements
- Android Studio
- Android device with USB debugging enabled or Android simulator
Quick Start
Setup
Install Android Studio.
Include
mavenCentral()repository in the top-levelbuild.gradle. Then add the following to the app'sbuild.gradle:
- Add the following to the app's
AndroidManifest.xmlfile to enable recording with an Android device's microphone:
Usage
Access the singleton instance of VoiceProcessor:
Add listeners for audio frames and errors:
Start audio capture with the desired frame length and audio sample rate:
Stop audio capture:
Once audio capture has started successfully, any frame listeners assigned to the VoiceProcessor
will start receiving audio frames with the given frameLength and sampleRate.
Capturing with Multiple Listeners
Any number of listeners can be added to and removed from the VoiceProcessor instance. However,
the instance can only record audio with a single audio configuration (frameLength and sampleRate),
which all listeners will receive once a call to start() has been made. To add multiple listeners:
Demo
For the Voice Processor Android SDK we have an example app that demonstrates how to use VoiceProcessor in an Android app.
Setup
Clone the android-voice-processor repository from GitHub:
Usage
- Open the example app using Android Studio or build with Gradle:
- Toggle recording on and off with the button in the center of the screen. While recording, the VU meter on the screen will respond to the volume of incoming audio.
For more information on our Voice Processor demo for Android, head over to our GitHub repository.