π΅ Realtime Audio
RealtimeAudio is a Flutter package that handles audio recording and playback of data chunks from real-time sources, like OpenAI Realtime, ElevenLabs or HumeAI Voice.
β¨ Features
- π€ Audio recording with variable chunk length in milliseconds.
- π Audio playback of data chunks.
- β±οΈ Duration tracking of audio chunks.
- βΈοΈ Pause support.
- π Volume tracking in dBFS.
- ποΈ Voice isolation and other processing on iOS.
- π± iOS audio session handling for max volume.
- π€ππ Android, iOS, and macOS support.
- βοΈ Audio response truncation support.
- π΅ Background audio track support.
π Usage
To use this package, add realtime_audio as a dependency in your pubspec.yaml file.
After initializing the RealtimeAudio object, you can start recording and playing audio chunks by calling start().
Audio will be played back in real-time, as soon as the first chunk is queued with queueChunk().
See the example project for a complete example.
π Permissions
π€ Android
-
Add Permissions to
AndroidManifest.xml:<uses-permission android:name="android.permission.RECORD_AUDIO"/>
π iOS
-
Add Permissions to
Info.plist: Open yourInfo.plistfile and add the following keys:<key>NSMicrophoneUsageDescription</key> <string>We need access to the microphone to record audio.</string>
π macOS
-
Add Permissions to
Info.plist: Open yourInfo.plistfile and add the following keys:<key>NSMicrophoneUsageDescription</key> <string>We need access to the microphone to record audio.</string> -
Add Entitlements to release and debug
macos/*.entitlements: Open yourmacos/*.entitlementsfile and add the following:<key>com.apple.security.device.audio-input</key> <true/>Can also do this through XCode by selecting the target, then
Signing & Capabilities, then checkingAudio Input.