Audio Recording
iOS Quick Start
Platforms
- iOS (11.0+)
Requirements
Quick Start
Setup
Install Xcode.
Import the ios-voice-processor package into your project.
To import the package using SPM, open up your project's Package Dependencies in XCode and add:
To import it into your iOS project using CocoaPods, add the following line to your Podfile:
- Run the following from the project directory:
- Add the following to the app's
Info.plist
file to enable recording with your iOS device's microphone
Usage
Check if you have permission to record audio and request permission if needed:
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 iOS SDK we have an example app that demonstrates how to use VoiceProcessor
in an iOS app.
Setup
Clone the ios-voice-processor repository from GitHub:
Usage
- Install dependencies and setup environment:
Open the generated
ios-voice-processor.xcworkspace
and run the demo with a simulator or connected iOS device.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 iOS, head over to our GitHub repository.