Skip to content

ManyMath/sound

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sound

Cross-platform sound playback for Dart and Flutter with the goal of no additional system dependencies for users or devs to install. The only build- time requirement beyond Dart/Flutter is Rust, and eventually that will be obviated via precompiled binaries (TODO).

This is a melos monorepo:

Package What it is
packages/sound_dart Pure Dart (no Flutter); works in CLI tools. Reaches native audio over dart:ffi, with a pluggable backend registry.
packages/sound_flutter Flutter plugin. Builds the native library automatically (via cargokit) and re-exports the sound_dart API.
native/sound_cli Rust crate (the C ABI behind the FFI backend). Decodes WAV/MP3/OGG/FLAC and plays with no system deps - dlopens libasound.so.2 on Linux, libaaudio.so on Android.

Quick start (Dart CLI)

import 'package:sound_dart/sound_dart.dart';

final playback = await Sound.playFile('chime.wav', volume: 0.8);
await playback.onComplete;

Build the native library first: cargo build --manifest-path native/sound_cli/Cargo.toml.

Status

Host Status
Android Working
Android Emulator Working
iOS Working
iOS Simulator Working
macOS Working
Ubuntu 24.04 Working
Web Working
Windows 11 Working

Android Emulator tested on macOS, Ubuntu 24.04, and Windows 11. Web tested on macOS in Chrome and Safari, Ubuntu 24.04 in Chrome and Firefox, and Windows 11 in Chrome and Edge.

Development

Driven by melos (config lives in the root pubspec.yaml). After dart pub get (or flutter pub get):

dart run melos run native:build   # build the Rust shared library
dart run melos run analyze        # analyze sound_dart + sound_flutter
dart run melos run format         # check Dart formatting (format:fix to apply)
dart run melos run test           # Dart + Flutter tests
dart run melos run native:test    # Rust crate tests

About

Sound for Dart and Flutter

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • Dart 57.1%
  • Rust 20.9%
  • CMake 8.1%
  • C++ 7.7%
  • Ruby 1.7%
  • Shell 1.5%
  • Other 3.0%