sounds 0.9.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 85

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:

ClassUsage
SoundPlayerUIA Flutter Widget Audio Player
SoundRecorderUIA Flutter Widget for recording
QuickPlayPlays an audio file without a UI.
SoudPlayer.noUIAPI to playback audio with fine grained control
SoundPlayer.withShadeUIAPI to playback audio using the OS's Shade (media player)
SoundRecorderAPI to record audio with fine grained control.
TrackContainer for audio used by all of the above classes.
MediaFormatDefines what MediaFormat is being used.
RecorderPlaybackControllerFlutter InheritedWidget used to co-ordinate Recording and Playback in a single UI.
AlbumsPlay a sequence of Tracks via the OS's Shade (media player)

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

Help Maintenance #

I've been maintaining quite many repos these days and burning out slowly. If you could help me cheer up, buying me a cup of coffee will make my life really happy and get much energy out of it. <br/> Buy Me A Coffee Paypal

0.9.2 #

Updated doco links committed hacks to work around flutter build bug.

0.9.1 #

Fixed a compile error due to a bad import.

0.9.0 #

This release includes some major changes to the api and the removal of FFMPEG resulting in a significantly small build size.

This release includes #10 #5 and parts of #3.

All api calls which used a Codec now use a MediaFormat. When playing audio a MediaFormat is no longer required unless you need to obtain the duration.

The platform code for obtaining a duration has bee changed from using ffmpeg to using the platform native methods.

Sounds now only supports playback and recording of native media formats. The sounds_codec package ( a work in progress ) has been created to provide utility methods for converting media formats. The idea being that if you want to play an non-native audio file that you first convert it to a native format and the play it using sounds. The same goes for recording. Record to a native format and then uses sounds_codec to convert the audio to the desired format.

It is expected that this release will be very close to the 1.0 release api as no major changes are now planned only bug fixes.

0.8.9 #

Removed the ext_storage package as its no longer used.

0.8.8 #

0.8.8 #

0.8.7 #

Continuing work on the doco.

0.8.6 #

continuing improvements to the doco. added _nullable to the pointer as required by the latest version of xcode. Fixed error no visible @interface for 'FFmpegPlugin' declares the selector 'alloc'. As the var name was the same case as the type.

0.8.5 #

Fixed compile error on Recase.

0.8.4 #

Fixed the wiki links.

0.8.3 #

doco renamed playbackEnabled to enablePlayback setup imags directory for wiki. revered to old logger for compatability removed recase as was conflicting without projects for one line of code. cancel is a method not a getter.

0.8.2 #

Fixed additonal lints and fixed a bug in the downloader not closing a subscription.

0.8.1 #

Essentially cleanup of lints formatting. First pass at cleanup of readme. Some initial cleanup of doco. Customised the logo. rough pass at forking flutter sound.

0.8.0 #

Rough draft of fork.

example/lib/main.dart

/*
 * This file is part of Sounds .
 *
 *   Sounds  is free software: you can redistribute it and/or modify
 *   it under the terms of the Lesser GNU General Public License
 *   version 3 (LGPL3) as published by the Free Software Foundation.
 *
 *   Sounds  is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the Lesser GNU General Public License
 *   along with Sounds .  If not, see <https://www.gnu.org/licenses/>.
 */

import 'package:flutter/material.dart';

import 'demo_util/demo_body.dart';

/// demonstrates the recording widget linked to a playback widget.
void main() {
  runApp(MyApp());
}

/// Example app.
class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Sounds'),
        ),
        body: MainBody(),
      ),
    );
  }

  @override
  void dispose() {
    super.dispose();
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  sounds: ^0.9.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:sounds/sounds.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
71
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
85
Learn more about scoring.

We analyzed this package on Jul 15, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Linux

Because:

  • package:sounds/sounds.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Web

Because:

  • package:sounds/sounds.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Windows

Because:

  • package:sounds/sounds.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform macOS

Because:

  • package:sounds/sounds.dart that declares support for platforms: Android, iOS

Package not compatible with SDK dart

Because:

  • sounds that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
device_info >=0.4.2+4 <2.0.0 0.4.2+4
flutter 0.0.0
flutter_spinkit ^4.0.0 4.1.2+1
meta ^1.1.8 1.1.8 1.2.2
path ^1.6.4 1.7.0
path_provider ^1.6.7 1.6.11
provider ^4.1.0 4.3.1
sounds_common ^1.0.1 1.0.6
uuid ^2.0.4 2.2.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
file 5.2.1
intl 0.16.1
logger 0.9.1
nested 0.0.4
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
Dev dependencies
dshell ^1.0.0
e2e ^0.5.0
effective_dart ^1.2.1
flutter_driver
flutter_test
lint ^1.1.1
pedantic ^1.9.0 1.9.0 1.9.2
pub_semver ^1.4.4