Audio Kit
A lightweight Audio recorder and player for Flutter, built with Zig, miniaudio.
The native audio engine is compiled for Android CPU architectures and exposed to Flutter through FFI.
Ios will be soon
Features
Audio Recorder
The recorder supports:
- Start recording to a file
- Stop recording
- Pause recording
- Resume recording
- File-based recording output
Start recording
final input = "/path/to/recording.wav";
AudioRecorder.start(input);
Stop recording
AudioRecorder.stop();
Pause / Resume recording
if (AudioRecorder.isPaused) {
AudioRecorder.resume();
print("Recording resumed!");
} else {
AudioRecorder.pause();
print("Recording paused!");
}
A typical recording flow is:
AudioRecorder.start(input);
// Pause when required
AudioRecorder.pause();
// Resume when required
AudioRecorder.resume();
// Finish recording
AudioRecorder.stop();
Audio Player
The player supports:
- Play an audio file
- Pause playback
- Resume playback
- Restart playback from the beginning
- Stop playback
Play
void _play() {
bool success = AudioPlayer.play(widget.audioFilePath);
print(widget.audioFilePath);
if (success) {
setState(() {
_isPlaying = true;
_isPaused = false;
});
}
print("Playback started: $success");
}
Pause
void _pause() {
AudioPlayer.pause();
setState(() {
_isPlaying = false;
_isPaused = true;
});
print("Playback paused");
}
Resume
void _resume() {
AudioPlayer.resume();
setState(() {
_isPlaying = true;
_isPaused = false;
});
print("Playback resumed");
}
Restart
void _restart() {
AudioPlayer.restart();
setState(() {
_isPlaying = true;
_isPaused = false;
});
print("Playback restarted");
}
Stop
void _stop() {
AudioPlayer.stop();
setState(() {
_isPlaying = false;
_isPaused = false;
});
print("Playback stopped");
}
Android CPU / ABI Support
This package currently supports Android devices only.
Native libraries are provided for the following Android ABIs:
jnilibs/
├── arm64-v8a/
├── armeabi-v7a/
└── x86_64/
Supported architectures
ABI CPU
arm64-v8a 64-bit ARM
armeabi-v7a 32-bit ARM
x86_64 64-bit x86
arm64-v8a is recommended for modern Android phones and tablets.
Architecture
The package uses the following stack:
Flutter / Dart
│
│ Dart FFI
▼
Native Audio API
│
│
▼
Zig
│
│
▼
miniaudio
│
▼
Android Audio System
Future Development
iOS Support
iOS support is planned as a future development milestone.