연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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';
...
void listener(dynamic obj) {
var buffer = Float64List.fromList(obj.cast<double>());
print(buffer);
}
void onError(Object e) {
print(e);
}
...
FlutterAudioCapture plugin = new FlutterAudioCapture();
await plugin.init();
await plugin.start(listener, onError, sampleRate: 16000, bufferSize: 3000);
await plugin.stop();