mic_stream 0.1.0 mic_stream: ^0.1.0 copied to clipboard
Provides a tool to get the microphone input as Byte Array Stream
mic_stream #
[Flutter Plugin] Provides a tool to get the microphone input as Byte Stream (Stream
About mic_stream: #
As Flutter still lacks some functionality, this plugin aims to provide the possibility to easily get an audio stream from the microphone, using a simple java implementation [=> Android only, iOS Support planned in the future].
!Important! #
Returns a stream of Uint8List objects, where each List contains 0.01s of sample data (look at the length, each byte in it is one sample). A future release will allow to dynamically set the amount of bytes per element in the stream
Example #
/** Instantiate a 'Microphone' object inheriting the 'StreamController' class: */
Microphone microphone = new Microphone();
// Or as Broadcaster:
Microphone broadcast = new Microphone.broadcast();
// Instantiate a Java AudioRecord object and start recording with an optional sampling rate as argument:
microphone.start(); // Default: 32000
microphone.start(samplerate = 8000);
// .start() returns a Stream
microphone.start().listen((sample) => print(sample.toString());
// Or this:
StreamSubcription
// Or like this, esp. to use on a braodcaster with multiple possible subsriptors
Stream
// etc...
// To stop the streaming, call
microphone.stop();
Flutter #
About Flutter Plugins: https://flutter.io/developing-packages/
Flutter Documentation: https://flutter.io/docs