sounds

Sounds provide a complete api and Widgets for audio playback and recording. Both iOS and Android are supported.


Keywords
api, audio-player, flutter, flutter-package, recorder, widget
License
LGPL-3.0

Documentation

Sounds

Sounds is a fork of the Flutter Sound project.

Sounds is almost a complete rewrite of the dart code from Flutter Sound. The aim of the rewrite has been resolve a number of issues apparent in Flutter Sound:

  • jank during playback.
  • crashes due to threading issues.
  • redesign the api so it is clean and consistent.
  • design an api that will accomodate future expansion of the core feature set.
  • provide additional features.
  • Hide internal apis from the public api.
  • Provide a consistent error handling mechanisim via exceptions.
  • Remove duplicated code.
  • Bring the code in line with Google's recommended best practices.

pub version

Overview

The Sounds package is a Flutter package that provides audio recording and playback functionality for both the android and ios platforms.

Sounds provides both a high level api and widgets for recording and playback.

The api is designed so you can use the supplied widgets or roll your own.

The Sounds package supports playback from:

  • Assets
  • Files
  • URL
  • Native Streams (with sync).

Features

The Sounds package includes the following features

  • Play audio without any UI
  • Play audio using the built in SoundPlayerUI Widget.
  • Play audio using the OSs' Media Player
  • Roll your own UI utilising the Sounds api.
  • Record audio without any UI
  • Record audio using the builtin SoundRecorderUI Widget.
  • Roll your own Recording UI utilising the Sounds api.
  • Support for releasing/resuming resources when the app pauses/resumes.

The core classes are:

Class Usage
SoundPlayerUI A Flutter Widget Audio Player
SoundRecorderUI A Flutter Widget for recording
QuickPlay Plays an audio file without a UI.
SoudPlayer.noUI API to playback audio with fine grained control
SoundPlayer.withShadeUI API to playback audio using the OS's Shade (media player)
SoundRecorder API to record audio with fine grained control.
Track Container for audio used by all of the above classes.
MediaFormat Defines what MediaFormat is being used.
RecorderPlaybackController Flutter InheritedWidget used to co-ordinate Recording and Playback in a single UI.
Albums Play a sequence of Tracks via the OS's Shade (media player)

Help

Audio is a fundemental building block needed by almost every flutter project.

I'm looking to make Sounds the go to project for Flutter Audio with support for each of the Flutter supported platforms.

Sounds is a large and complex project which requires me to maintain multiple hardware platforms and test environments.

I greatly appreciate any contributions to the project which can be as simiple as providing feedback on the api or documentation.

See the Contributing section below for details.

Sponsorship

If you can't help out by directly contributing code maybe you could Sponsor me so I can spend more time improving Sounds.

Sounds is a large commitment and I'm maintaining several other dart related projects so any support would be greatly appreciated.

Key short term goals are:

  • Hire a graphics designer to improve the look of the widgets
  • Provide support for the web
  • Provide support for a wider range of Codecs
  • Provide support for streaming

If I can get enough sponsorship I intend hiring a grad to do a chunk of the dirty work so I can focus on some of the larger features such as Web Support.

You can find the purple heart Sponser button at the top of the page.

If you can't afford a coffee then show your support by 'liking' the Sounds project on the pub.dev site.

Documentation

Install

Wiki High level guide to using Sounds.

API Reference

Roadmap

See the Roadmap for details on the future of Sounds.

Contributing

See the Contributing guide for details on contributing to Sounds.

The key classes are:

Api classes

QuickPlay - instantly play an audio file (no ui). Perfect for the odd beep.

Track - Defines a track including the artist details and the audio media.

Album - play a collection of tracks via the OSs' audio UI.

SoundPlayer - provides an api for playing audio including pause/resume/seek.

SoundRecorder - api for recording audio.

Widgets

SoundPlayerUI - displays an HTML 5 style audio controller widget.

SoundRecorderUI - displays a recording widget.

RecorderPlaybackController - pairs a SoundPlayerUI and SoundRecorderUI to provide a co-ordinated recording/playback UI.

Note: there are some limitations on the supported MediaFormat. See the [MediaFormat] section below.

Demo