streamLoop() is a very simple example which connect the FlutterSoundRecorder sink to the FlutterSoundPlayer Stream. Of course, we do not play to the loudspeaker to avoid a very unpleasant Larsen effect. this example does not use a new StreamController, but use directely foodStreamController from flutter_sound_player.dart.
startPlayerFromStream can be very efficient to play sound effects in real time. For example in a game App. In this example, the App open the Audio Session and call startPlayerFromStream() during initialization. When it want to play a noise, it has just to call the synchronous verb feed. Very fast.
A very simple example showing how to play Live Data with back pressure. It feeds a live stream, waiting that the Futures are completed for each block.
This example get the data from an asset file, which is completely stupid : if an App wants to play an asset file he must use "StartPlayerFromBuffer().
If you do not need any back pressure, you can see another simple example : . This other example is a little bit simpler because the App does not need to await the playback for each block before playing another one.
The complete example source
Examples
Flutter Sound Demo.
Demo
This is a Demo of what it is possible to do with Flutter Sound. The code of this Demo app is not so simple and unfortunately not very clean :-( .
Flutter Sound beginners : you probably should look to and
Examples
Playback From Stream(1)
livePlaybackWithoutBackPressure
A very simple example showing how to play Live Data without back pressure. It feeds a live stream, without waiting that the Futures are completed for each block. This is simpler than playing buffers synchronously because the App does not need to await that the playback for each block is completed playing another one.
This example get the data from an asset file, which is completely stupid : if an App wants to play a long asset file he must use
Examples
Widget UI
WidgetUIDemo
This is a Demo of an App which uses the Flutter Sound UI Widgets.
My own feeling is that this Demo is really too much complicated for doing something very simple. There is too many dependencies and too many sources.
Examples
RecordToStream
RecordToStream
This is an example showing how to record to a Dart Stream. It writes all the recorded data from a Stream to a File, which is completely stupid: if an App wants to record something to a File, it must not use Streams.
The real interest of recording to a Stream is for example to feed a Speech-to-Text engine, or for processing the Live data in Dart in real time.
Examples
Simple Playback
SimplePlayback
This is a very simple example for Flutter Sound beginners, that shows how to play a remote file.