Skip to content

Realtime audio plugin for Flutter, to handle audio playback and microphone recording for OpenAI Realtime API, HumeAI Voice and others.

License

Notifications You must be signed in to change notification settings

volskaya/realtime_audio.flutter

Repository files navigation

🎵 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.

📖 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 your Info.plist file 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 your Info.plist file 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 your macos/*.entitlements file 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 checking Audio Input.

About

Realtime audio plugin for Flutter, to handle audio playback and microphone recording for OpenAI Realtime API, HumeAI Voice and others.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published