Search packages, repositories and app categories

Package detailsv1.1.12

flutter_audio_capture

Capture the audio buffer stream through microphone for iOS/Android.

AndroidiOSLinux
30-day downloads
1.2K
Likes
34
Pub points
130

Install package

flutter pub add flutter_audio_capture

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

flutter_audio_capture is a Flutter plugin that enables real-time audio recording from the device's microphone on Android, iOS, and Linux. It provides access to raw audio buffer streams, making it suitable for applications requiring low-level audio processing such as voice analysis, live audio effects, or custom audio pipelines. The package integrates seamlessly with Flutter’s event-driven architecture and supports continuous audio streaming with configurable sample rates and channel counts. It is ideal for developers building audio-centric apps needing direct control over audio input.

Use cases

  • Real-time voice processing
  • Audio visualization
  • Voice-controlled applications
  • Live audio streaming
  • Custom audio effects

Key features

  • Raw audio buffer stream access
  • Cross-platform support (Android, iOS, Linux)
  • Configurable sample rate and channels
  • Low-latency audio capture
  • Event-driven streaming API

Suitable for

  • Audio analysis tools
  • Voice recognition systems
  • Music production apps
  • Interactive audio experiences
  • Real-time communication apps

Considerations

  • Requires microphone permissions
  • May consume significant battery
  • High CPU usage during continuous capture
  • Limited documentation
  • Platform-specific configuration needed

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

flutter_audio_capture

Capture the audio stream buffer through microphone for iOS/Android. Required OS version is iOS 13+ or Android 23+

Getting Started

Add this line to your pubspec.yaml file:

dependencies:
  flutter_audio_capture: ^1.1.12

and execute

$ flutter pub get
Android

If you want to use this package on Android OS, you need to set RECORD_AUDIO permission to AndroindManifest.xml like below.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.ymd.flutter_audio_capture">
  ...
  // Add this line
  <uses-permission android:name="android.permission.RECORD_AUDIO"/>
</manifest>
iOS

If you want to use this package on iOS, you need to set NSMicrophoneUsageDescription to Info.plist like below.

<dict>
    <key>NSMicrophoneUsageDescription</key>
    <string>Need microphone access to capture audio</string>
...
Linux

On Linux, this package uses parec to record audio.

While things should just work on recent Ubuntu versions, make sure to have pulseaudio installed on the target device.

Example

You can see full example in example/lib/main.dart

import 'package:flutter_audio_capture/flutter_audio_capture.dart';
...

// Callback function if device capture new audio stream.
// argument is audio stream buffer captured through mictophone.
// Currentry, you can only get is as Float64List.
void listener(dynamic obj) {
  var buffer = Float64List.fromList(obj.cast<double>());
  print(buffer);
}

// Callback function if flutter_audio_capture failure to register
// audio capture stream subscription.
void onError(Object e) {
  print(e);
}

...

FlutterAudioCapture plugin = new FlutterAudioCapture();

// Initialize the plugin (required before start)
await plugin.init();

// Start to capture audio stream buffer
// sampleRate: sample rate you want
// bufferSize: buffer size you want (iOS only)
await plugin.start(listener, onError, sampleRate: 16000, bufferSize: 3000);

// Stop to capture audio stream buffer
await plugin.stop();

Categories

Source repository

Projects using this package