Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/llfbandit/record
Audio recorder from microphone to a given file path. No external dependencies, MediaRecorder is used for Android an AVAudioRecorder for iOS.
https://github.com/llfbandit/record
Last synced: 3 months ago
JSON representation
Audio recorder from microphone to a given file path. No external dependencies, MediaRecorder is used for Android an AVAudioRecorder for iOS.
- Host: GitHub
- URL: https://github.com/llfbandit/record
- Owner: llfbandit
- Created: 2020-06-25T16:37:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T19:50:01.000Z (6 months ago)
- Last Synced: 2024-05-22T20:52:19.738Z (6 months ago)
- Language: Dart
- Homepage: https://pub.dev/packages/record
- Size: 8.11 MB
- Stars: 197
- Watchers: 2
- Forks: 160
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-flutter-desktop - record - Audio recorder from microphone to file or stream with multiple codecs, bit rate and sampling rate options. (Packages)
README
Audio recorder from microphone to a given file path or stream.
No external dependencies:
- On Android, AudioRecord and MediaCodec or MediaRecorder.
- On iOS and macOS, AVFoundation.
- On Windows, MediaFoundation.
- On web, well... your browser! (and its underlying platform).External dependencies:
- On linux, encoding is provided by [fmedia](https://stsaz.github.io/fmedia/). It **must** be installed separately.## Platform feature parity matrix
| Feature | Android | iOS | web | Windows | macOS | linux
|------------------|---------------|-----------------|---------|------------|-------|-----------
| pause/resume | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️
| amplitude(dBFS) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| permission check | ✔️ | ✔️ | ✔️ | | ✔️ |
| num of channels | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️
| device selection | ✔️ 1 / 2 | (auto BT/mic) | ✔️ | ✔️ | ✔️ | ✔️
| auto gain | ✔️ 2 |(always active?)| ✔️ | | |
| echo cancel | ✔️ 2 | | ✔️ | | |
| noise suppresion | ✔️ 2 | | ✔️ | | |## File
| Encoder | Android | iOS | web | Windows | macOS | linux
|-----------------|----------------|---------|---------|---------|---------|---------
| aacLc | ✔️ | ✔️ | ? | ✔️ | ✔️ | ✔️
| aacEld | ✔️ | ✔️ | ? | | ✔️ |
| aacHe | ✔️ | | ? | | | ✔️
| amrNb | ✔️ | | ? | ✔️ | |
| amrWb | ✔️ | | ? | | |
| opus | ✔️ | | ✔️ 3 | | | ✔️
| wav | ✔️ 2 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️
| flac | ✔️ 2 | ✔️ | ? | ✔️ | ✔️ | ✔️
| pcm16bits | ✔️ 2 | ✔️ | ✔️ | ✔️ | ✔️ |* Question marks (?) in web column mean that the formats are supported by the plugin
but are not available in current (and tested) browsers (Chrome / Firefox).## Stream
| Encoder | Android | iOS | web | Windows | macOS | linux
|-----------------|------------|---------|---------|---------|---------|---------
| aacLc * | ✔️ 2 | | | | |
| aacEld * | ✔️ 2 | | | | |
| aacHe * | ✔️ 2 | | | | |
| pcm16bits | ✔️ 2 | ✔️ | ✔️ | ✔️ | ✔️ |\* AAC is streamed with raw AAC with ADTS headers, so it's directly readable through a file!
1. Bluetooth telephony device link (SCO) is automatically done but there's no phone call management.
2. Unsupported on legacy Android recorder.
3. Sample rate output is determined by your settings in OS. Bit depth is likely 32 bits.## Usage
```dart
import 'package:record/record.dart';final record = AudioRecorder();
// Check and request permission if needed
if (await record.hasPermission()) {
// Start recording to file
await record.start(const RecordConfig(), path: 'aFullPath/myFile.m4a');
// ... or to stream
final stream = await record.startStream(const RecordConfig(AudioEncoder.pcm16bits));
}// Stop recording...
final path = await record.stop();
// ... or cancel it (and implicitly remove file/blob).
await record.cancel();record.dispose(); // As always, don't forget this one.
```## Setup, permissions and others
### Android
Follow [Gradle setup](https://github.com/llfbandit/record/blob/master/record_android/README.md) if needed.```xml
```
- min SDK: 23 (amrNb/amrWb: 26, Opus: 29)* [Audio formats sample rate hints](https://developer.android.com/guide/topics/media/media-formats#audio-formats)
### iOS
```xml
NSMicrophoneUsageDescription
Some message to describe why you need this permission
```
- min SDK: 11.0### macOS
```xml
NSMicrophoneUsageDescription
Some message to describe why you need this permission
```- In capabilities, activate "Audio input" in debug AND release schemes.
- or directly in *.entitlements files
```xml
com.apple.security.device.audio-input```
- min SDK: 10.15
### Web
Web platform uses package web >=0.5.1 which is shipped with Flutter >=3.22.
This platform is still available with previous Flutter versions but continuous work is done from this version only.