arrow-left

All pages
gitbookPowered by GitBook
1 of 10

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Examples

Simple Recorder

hashtag
SimpleRecorder

SimpleRecorderarrow-up-right

This is a very simple example for Flutter Sound beginners, that shows how to record, and then playback a file.

This example is really basic.

The complete example source

is therearrow-up-right

Examples

Stream Loop

hashtag
streamLoop

streamLooparrow-up-right

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.

The complete example source

Examples

Sound Effects

hashtag
soundEffect

soundEffectarrow-up-right

startPlayerFromStreamarrow-up-right 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.

The complete example source

is therearrow-up-right
is therearrow-up-right

examples

Examples

Playback From Stream (2)

hashtag
livePlaybackWithBackPressure

livePlaybackWithBackPressurearrow-up-right

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.

hashtag
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)

hashtag
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

hashtag
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

hashtag
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

hashtag
SimplePlayback

This is a very simple example for Flutter Sound beginners, that shows how to play a remote file.

This example is really basic.

LivePlaybackWithoutBackPressure.dartarrow-up-right
is therearrow-up-right
The biggest interest of this Demo is that it shows most of the features of Flutter Sound :
  • Plays from various media with various codecs

  • Records to various media with various codecs

  • Pause and Resume control from recording or playback

  • Shows how to use a Stream for getting the playback (or recoding) events

  • Shows how to specify a callback function when a playback is terminated,

  • Shows how to record to a Stream or playback from a stream

  • Can show controls on the iOS or Android lock-screen

  • ...

It would be really great if someone rewrite this demo soon

The complete example source is therearrow-up-right

Demoarrow-up-right
SimplePlaybackarrow-up-right
SimpleRecorderarrow-up-right
I really hope that someone will write soon another simpler Demo App.

The complete example source is therearrow-up-right

WidgetUIDemoarrow-up-right
The complete example source is therearrow-up-right
RecordToStreamarrow-up-right
.

Feeding Flutter Sound without back pressure is very simple but you can have two problems :

  • If your App is too fast feeding the audio channel, it can have problems with the Stream memory used.

  • The App does not have any knowledge of when the provided block is really played.

    For example, if it does a "stopPlayer()" it will loose all the buffered data.

This example uses the FoodEventarrow-up-right object to resynchronize the output stream before doing a stopPlayer()arrow-up-right

The complete example source is therearrow-up-right

livePlaybackWithoutBackPressurearrow-up-right
startPlayer()arrow-up-right
The complete example source
SimplePlaybackarrow-up-right
is therearrow-up-right