raw_sound 0.1.1+1 raw_sound: ^0.1.1+1 copied to clipboard
A flutter plugin for playing raw PCM audio data (16-bit integer and 32-bit float).
raw_sound #
A flutter plugin for playing raw PCM audio data (16-bit integer and 32-bit float).
Platform Support #
Android (Kotlin) | iOS (Swift) |
---|---|
minSdkVersion 24 |
platform :ios, '14.0' |
✔️ | ✔️ |
Usage #
- Create an instance of the RawSoundPlayer
final _player = RawSoundPlayer();
- Initialize the player instance with parameters of bufferSize, nChannels, sampleRate and pcmType
await _player.initialize(
bufferSize: 4096 << 3,
nChannels: 1,
sampleRate: 16000,
pcmType: RawSoundPCMType.PCMI16,
);
- Start the playback
await _player.play();
- Feed the player instance with the raw PCM data
while (_player.isPlaying) {
await _player.feed(dataBlock);
}
- Pause the playback
await _player.pause();
- Stop the playback
await _player.stop();
- Release the player instance
await _player.release();