Skip to content
 
 

Repository files navigation

A low-level audio plugin for Flutter.

Pub Version style: very good analysis

Linux Windows Android MacOS iOS Web
Support 💙 💙 💙 💙 💙 💙
Minimum Version Any Any 21+ 10.15+ 13.0+ iOS 16.4+
Safari 16.4+
Chrome 91+
Edge 91+
Firefox 89+

Overview

A high-performance audio plugin designed primarily for games and immersive applications, providing low latency and advanced features.

Key Features

  • ⚡ Low latency, high performance audio
  • 🎮 3D positional audio with Doppler effect
  • 🔄 Gapless looping
  • 🔄 Stream audio with auto-pause for buffering, support for PCM, MP3, Ogg with Opus, Vorbis and FLAC containers
  • 📊 Get audio wave and/or FFT audio data in real-time (useful for visualization)
  • 🎛️ Rich effects system (reverb, echo, limiter, equalizer, pitch shift, etc.)
  • ⚙️ Faders for attributes (e.g. fade out for 2 seconds, then stop)
  • 🎚️ Oscillators for attributes
  • 🌊 Waveform generation and visualization
  • 🔊 Multiple voices, playing different or even the same sound multiple times
  • 🎵 Support for MP3, WAV, OGG, and FLAC
  • ⏱️ Read audio data samples from a file with a given time range
  • 🌊 Generate waveforms in real-time with various types (sine, square, saw, triangle, etc.)

Getting Started

If you are looking for a package to visualize audio using shaders or CustomPainter, please check out audio_flux. It uses this plugin for output and flutter_recorder for input.

Also, if you are building using Swift Package Manager (SPM), please check out iOS and MacOS Configuration.

Documentation

Simple Example

void example() async {
  final soloud = SoLoud.instance;
  await soloud.init();

  await soloud.playSource(asset: 'assets/sound.mp3');
  
  [...]
  await soloud.deinit();
}

Output-Device Lifecycle

Voice state and output-device state are separate. Pausing a voice preserves its SoundHandle and its SoLoud state. Device lifecycle operations only stop, start, or prewarm the platform audio output; they do not maintain a second copy of voice volume, pan, speed, fades, looping, seek position, or other properties.

play() and play3d() are synchronous and return a SoundHandle immediately. An unpaused voice starts the output device after the voice has been created successfully. Creating a paused voice does not start the device; unpausing it later does.

When no unpaused voices remain, the output device follows the configured idle timeout:

  • setAudioDeviceIdleTimeout(Duration.zero) stops it as soon as possible.
  • A positive duration keeps it running for that grace period.
  • setAudioDeviceIdleTimeout(null) keeps it running indefinitely, including across deinit() and a later init().

startAudioDevice() temporarily starts or prewarms the output and completes after startup finishes. It does not enable permanent keep-alive; if the engine is still idle, the configured timeout begins again. stopAudioDevice() is an idle-only conditional stop by default, so it succeeds without interrupting active playback. Use stopAudioDevice(force: true) only when the output must be stopped while voices remain active; their voice state is not changed.

getAudioDeviceState() is a cheap synchronous read of the actual backend state: uninitialized, stopped, started, starting, or stopping. It does not report a pending scheduler request.

Apps & Games Using flutter_soloud

A showcase of apps and games built with this plugin:

App/Game Developer Description
GPhil
web macOS Windows
Vyacheslav Gryaznov Innovative app designed for musicians to play instrumental concertos with flexible virtual orchestral accompaniment.
Forcebar Doug Todd Forcebar is a pure reflex game.
RadioVisualizer Marco Bavagnoli Stream over 35,000 live radio stations from every corner of the globe.
Stellar Bastion
web Android iOS
Coconut Island Apps 2D Tower Defense game.
Mortigen
web Android iOS
Luis Enrique Ruiz Roguelite survival shooter.
SUMOJI
web Android iOS
Valentin Martinet Fun Emoji-based Sudoku.

Want to add your app? Feel free to open a PR!

License

The Dart plugin is covered by the MIT license. For information about the underlying SoLoud engine license, see the documentation.

About

Flutter low-level audio plugin using SoLoud C++ library and FFI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages