raw_sound

Creator: coderz1093

Last updated:

0 purchases

raw_sound Image
raw_sound Images
Add to Cart

Description:

raw sound

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();
copied to clipboard

Initialize the player instance with parameters of bufferSize, nChannels, sampleRate and pcmType

await _player.initialize(
// Buffer size of the underlying audio track (Android only)
bufferSize: 4096 << 3,
// Number of channels, either 1 or 2
nChannels: 1,
// Sample rate for playback in Hz
sampleRate: 16000,
// PCM format type, either PCMI16 (16-bit integer) or PCMF32 (32-bit float)
pcmType: RawSoundPCMType.PCMI16,
);
copied to clipboard

Start the playback

await _player.play();
copied to clipboard

Feed the player instance with the raw PCM data

// Demonstrate how to continuously feed the player until the playback is paused/stopped
while (_player.isPlaying) {
await _player.feed(dataBlock);
}
copied to clipboard

Pause the playback

// Pause immediately and keep queued buffers
await _player.pause();
copied to clipboard

Stop the playback

// Stop immediately and drop queued buffers
await _player.stop();
copied to clipboard

Release the player instance

// Remember to release any initialized player instances
await _player.release();
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.

Related Products

More From This Creator