flutter_pcm_sound
3.3.3, released a year ago by jamcorder.com
Send real-time 16-bit PCM audio to device speakers from Flutter.
What it does
It streams real-time PCM audio (16-bit integer) directly to device speakers using a low-frequency, event-based callback mechanism. It is designed for applications that generate audio on the fly, such as software synthesizers or custom audio generators.
AI-written summary of version 3.3.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building an app that generates audio in real-time (e.g., soundfonts, synthesizers).
- You want a low-dependency solution to stream raw PCM audio frames to device speakers.
Skip it when
- You just want to play pre-recorded audio files like MP3s or WAVs.
- You need a high-level music player or streaming framework.
Strengths
- Zero dependencies besides Flutter and the host platform.
- Event-based feeding integrates well with the Flutter event loop.
- Cross-platform support for Android, iOS, and macOS.
Weaknesses
- Not designed for playback of standard audio files.
- Requires manual sample generation and buffer management.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Enable required platforms in your Flutter project configuration.
void onFeed(int remainingFrames) async {
List<int> frame = scale.generate(periods: 20);
await FlutterPcmSound.feed(PcmArrayInt16.fromList(frame));
}
await FlutterPcmSound.setup(sampleRate: 44100, channelCount: 1);
await FlutterPcmSound.setFeedThreshold(8000);
FlutterPcmSound.setFeedCallback(onFeed);
FlutterPcmSound.start();Alternatives
Packages that do the same job and could replace flutter_pcm_sound.
- audioplayers
Pick audioplayers if you need to play pre-recorded audio files or URLs rather than streaming raw PCM data.
87Compare - just_audio
Pick just_audio for feature-rich audio playback of files, playlists, and streams.
80Compare