Skip to main content

just_audio_engine 1.1.0 copy "just_audio_engine: ^1.1.0" to clipboard
just_audio_engine: ^1.1.0 copied to clipboard

Game audio for Flutter: sound effects, music, streams and 3D sound, worked out in Dart and played natively by XAudio2, AVAudioEngine, OpenAL Soft, SoundPool and Web Audio.

1.1.0 #

3D audio, worked out once in Dart and the same on every platform; Linux builds; and fixes on every platform.

3D audio #

  • AudioSpatial says how a 3-D sound is heard: full volume within minDistance, silent beyond maxDistance, faded between by AudioRolloff (inverse, linear, none); dopplerLevel (pitch from how fast the sound and the listener move, at AudioEngine.speedOfSound); farCutoff (a low-pass that muffles it with distance). AudioSpatial.mix works out a sound's volume, pan, pitch and cutoff from a listener — public, for tools and tests.
  • playSfx(position3d:, spatial:) places a sound from its first sample (it used to start centred and full, and move a message later). updateSfxPosition and setListener3D take effect at the next update, which places every 3-D sound and sends what changed in one platform call (AudioBackend.setVoiceMixes), instead of one call per sound per frame. update({dt}) takes the frame's time for velocities; setSfxSpatial changes a playing sound's settings.
  • The platforms' own 3-D engines are gone (X3DAudio, AVAudioEnvironmentNode, OpenAL positions, the web's PannerNode): every platform now pans at equal power, folds a stereo file to mono for a 3-D sound (not Android), and has a low-pass on 3-D sounds (not Android). Before, Windows ignored the listener and reset pitch on every move, macOS and iOS never placed a sound, Android panned by x alone, and Linux attenuated even music by where the listener stood.

Playback #

  • playSfx(channel:) plays on any channel, with its volume (and, on the web, its bus); every sound effect used to play on sfx.
  • Master volume is applied once, by the platform (it was applied two or three times); channel volumes once, in Dart (the web applied them twice). A sound played while muted is heard after unmute.
  • A sound effect that plays to its end, or is evicted for another, is forgotten (isSfxPlaying); finished clips used to stay forever, and a paused one could be dropped.
  • Audio from a package's assets plays: a path like packages/<name>/sfx/jump.wav is used as the asset key it already is, on every backend, instead of being read as assets/packages/…. Asset Store items ship their sounds this way.
  • setLoop works on a sound that is playing on Windows, iOS and macOS (it was only kept for the next play): set to loop, it carries on past its end; set back, it ends after the pass that is playing.
  • cancelFadeSfx/cancelFadeMusic stop a fade on every native platform; they threw MissingPluginException there. A new fade on a voice also stops the one already running instead of fighting it.
  • A hot restart no longer crashes the app or leaves the last session's sounds playing. The native player outlives the Dart isolate, and a restarted app initializes it again without having disposed it: every platform now disposes the old session first (on Windows a second XAudio2 engine was released under live voices, crashing the next dispose; on Linux a second poller thread was std::terminate).
  • With no audio plugin (a test, a headless run) nothing loads, plays or throws, and a sound asked for later does not try to start the backend again; a method a platform's plugin does not have is a no-op there instead of an exception in the game. isInitialized says whether the backend has started.
  • stopAllSfx and the channel-volume update are one platform call each, not one per voice.

Platforms #

  • Updates the minimum supported SDK version to Flutter 3.44/Dart 3.12.
  • Windows: pitch and speed no longer overwrite each other (the rate is their product); pan works on a device with more than two channels; the voice's volume no longer carries the master volume too.
  • macOS and iOS: sounds load — assets are looked up in flutter_assets through FlutterDartProject.lookupKey(forAsset:), as Android and Windows already did, instead of in the app bundle's own resources, where they never are. The volume is no longer squared, a fade-in is heard, and a sound's audio nodes are let go when it ends (they were only freed by stop). iOS builds again: the player referred to a class from another plugin (FlutterLocalNotificationsPlugin).
  • Android: migrates to built-in Kotlin — the plugin no longer applies the Kotlin Gradle plugin, which future Flutter versions refuse to build; it builds with AGP 9.1 and Kotlin 2.4, in apps with android.builtInKotlin on or off. loadSource answers once SoundPool has decoded the sound (a sound played straight after loading — the first play of every sound effect — was silent, "sample not READY"). Changing a voice's volume or the master volume no longer resets its pan, pitch × speed is honoured, a finished sound effect sends voiceEnded, fades no longer queue behind each other, and the unused media3 dependencies are gone.
  • Linux builds: its public header was missing and it did not compile; it now does, and plays assets (it cut their assets/ prefix), with HRTF off so it pans like every other platform.
  • Web: clearing a voice's effects no longer silences it. Depends on flutter_web_plugins: an app using the package on the web without it failed to build (the generated plugin registrant imports it).

Breaking #

  • AudioBackend: setVoiceMixes, playVoice(spatial:, lowPass:); setVoice3DPosition and setListener3D are gone, as is AudioClip.set3DPosition.
  • Native method channel: play takes spatial and lowPass; new setVoiceMixes, setVolumes, stopMany; set3DPosition and setListener3D are gone.

1.0.1 #

  • Shifted memory management responsibilities to the just_memory package for cleaner separation of concerns and improved maintainability.

1.0.0 #

  • Initial release of just_audio_engine — high-performance audio processing pipeline for just_game_engine.
  • Multi-platform support with platform-native backends:
    • iOS / macOS — AVAudioEngine
    • Windows — XAudio2
    • Linux — OpenAL Soft
    • Android — Oboe / SoundPool
    • Web — Web Audio API (dart:js_interop, no WASM required)
  • AudioEngine central facade: initialise, play, pause, resume, stop, and dispose audio from a single object.
  • Five logical audio channels: master, music, sfx, voice, and ambient.
  • Per-channel and master volume control; global mute/unmute.
  • AudioBus / AudioBusGraph for named mixer-bus routing with per-bus volume.
  • AudioClip lifecycle management with AudioState (stopped, playing, paused).
  • AudioStream for streaming long-form audio without full preload.
  • SoundEffectManager and MusicManager high-level helpers.
  • VoicePool for efficient voice reuse and limiting concurrent playback.
  • 3D spatial audio via Audio3DPosition and Audio3DListener (position, forward, up vectors).
  • DSP effects pipeline — AudioEffect supports: reverb, lowpass, highpass, bandpass, eq, distortion, chorus, delay.
  • Asset-path source cache to avoid redundant backend loads.
  • AudioEngine.withBackend() constructor for injecting a test double backend.
1
likes
150
points
92
downloads

Documentation

API reference

Publisher

verified publisherjustunknown.com

Weekly Downloads

Game audio for Flutter: sound effects, music, streams and 3D sound, worked out in Dart and played natively by XAudio2, AVAudioEngine, OpenAL Soft, SoundPool and Web Audio.

Repository (GitHub)
View/report issues
Contributing

Topics

#audio #sound #gamedev #game-engine #spatial-audio

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_web_plugins, just_memory, web

More

Packages that depend on just_audio_engine

Packages that implement just_audio_engine