Agent skill

Flutter SoLoud Audio Loading

by alnitak in alnitak/flutter_soloud

Explains how to load audio in flutter_soloud with loadAsset, loadMem, loadFile and loadUrl, pick a load mode, and dispose sounds correctly on every platform.

MITAuto-check: notesMobile

Install Flutter SoLoud Audio Loading

skills CLI
$ npx skills add alnitak/flutter_soloud --skill flutter-soloud-loading -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install alnitak/flutter_soloud flutter-soloud-loading --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/alnitak/flutter_soloud.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/flutter-soloud-loading .claude/skills/flutter-soloud-loading && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
flutter-soloud-loading
GitHub stars
424
Token cost
~2.6k tokens
SKILL.md length
1,099 words
Files
1
Skills in repo
14
Repo updated
First seen
Licence
MIT

At a glance

Explains how to load audio in flutter_soloud with loadAsset, loadMem, loadFile and loadUrl, pick a load mode, and dispose sounds correctly on every platform.

  • Loading an audio asset, file, URL or byte buffer in a Flutter app
  • SKILL.md covers Minimal example, The API shape, Traps and More depth, plus 1 more section
  • Calls dart, apt and dnf
  • Debugging a flutter_soloud load error or a sound that never plays

What it does

flutter_soloud works differently from audioplayers or just_audio: you load bytes into the SoLoud engine, get an `AudioSource` handle, play it as many times as you like, and dispose it yourself. The skill covers each loader on `SoLoud.instance`, which all need `init()` first or they throw `SoLoudNotInitializedException`. `loadAsset` takes an asset key, `loadMem` takes the bytes of an MP3, WAV, OGG or FLAC file, `loadFile` takes an absolute path, and `loadUrl` downloads the file first.

It also covers web limits, since `loadFile` is unavailable there and `loadMem` is the loader the others delegate to, along with CORS rules for URLs. The description adds `joinTwoSources`, the choice between `LoadMode.memory` and `LoadMode.disk`, and lifecycle tools such as `disposeSource`, `autoDispose` and `allInstancesFinished`. Use it to fix load errors, silent playback and leaked sounds.

When your agent uses it

  • Loading an audio asset, file, URL or byte buffer in a Flutter app
  • Debugging a flutter_soloud load error or a sound that never plays
  • Making audio loading work on Flutter web despite its restrictions
  • Cleaning up loaded sounds so native memory is released

Example prompts

  • “Load assets/sounds/click.mp3 with flutter_soloud and play it when the button is tapped.”
  • “My flutter_soloud loadUrl call throws a status code exception. What is going wrong?”
  • “Switch our long music track to disk loading mode and make sure it is disposed when the screen closes.”
  • “Why does loadFile fail in our Flutter web build, and what should we use instead?”

Requirements

  • A Flutter project using the `flutter_soloud` plugin

What it can do on your machine

Read from SKILL.md and the folder at commit 289697e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • dart
    • apt
    • dnf

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Flutter SoLoud Audio Loading loads about 2.6k tokens when it runs. Until then it costs about 115 tokens; SKILL.md has 1,099 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~115
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteRuns commands with sudoSKILL.md:54
    at`) installed on the host system (e.g. `sudo apt install ffmpeg libavcodec-extra`, `sudo pacman -S ffmpeg`, or `sudo dn

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from alnitak/flutter_soloud at commit 289697e, republished under its MIT licence (© alnitak). 1,099 words, ~2,594 tokens.

Download SKILL.mdSave it as .claude/skills/flutter-soloud-loading/SKILL.md (or your agent's skills folder).
name
flutter-soloud-loading
description
Teaches how to load audio into flutter_soloud via loadAsset/loadMem/loadFile/loadUrl and joinTwoSources, choose between LoadMode.memory and LoadMode.disk, and manage the AudioSource lifecycle (disposeSource, autoDispose, allInstancesFinished). Use when a user asks to load or play an audio file, asset, URL, or byte buffer, to fix load errors or "no sound" bugs, to handle web platform constraints, or to clean up/dispose loaded sounds.
version
2

Loading in flutter_soloud is a two-step model, unlike audioplayers/just_audio: you first load bytes into the SoLoud C++ engine and get an AudioSource handle, then play() it any number of times, and finally dispose it yourself. There is no setUrl/AudioPlayer object that owns a resource for you — the AudioSource is just a hash (soundHash) referencing native memory until you dispose it.

Minimal example

dart
import 'package:flutter_soloud/flutter_soloud.dart';

Future<void> main() async {
  await SoLoud.instance.init();

  final source = await SoLoud.instance.loadAsset(
    'assets/sound.mp3',
    autoDispose: true, // disposed automatically when playback finishes
  );

  final handle = SoLoud.instance.play(source);
  // One source, many concurrent instances:
  final handle2 = SoLoud.instance.play(source);

  // If not using autoDispose, dispose manually when done:
  await SoLoud.instance.disposeSource(source);
}

The API shape

All loaders are on SoLoud.instance and require await SoLoud.instance.init() first (otherwise every loader throws SoLoudNotInitializedException).

  • Future<AudioSource> loadAsset(String key, {LoadMode mode = LoadMode.memory, AssetBundle? assetBundle, bool autoDispose = false}) — key is an asset key like 'assets/sound.mp3' (NOT a file path). On native, the asset is copied to a temp file and loaded from there. On Web it reads the bundle bytes and delegates to loadMem, so it works everywhere.
  • Future<AudioSource> loadMem(String path, Uint8List buffer, {LoadMode mode = LoadMode.memory, bool autoDispose = false}) — buffer is the bytes of a supported audio file (MP3/WAV/OGG/FLAC), not raw PCM. path is only a reference name to distinguish this buffer (e.g. 'my_sound.mp3'), not a real filesystem path. The only loader usable on Web (and the one loadAsset/loadUrl delegate to there); on Web mode is ignored and data is fed to the engine in chunks, yielding to the event loop to keep the UI responsive.
  • Future<AudioSource> loadFile(String path, {LoadMode mode = LoadMode.memory, bool autoDispose = false}) — absolute filesystem path. NOT available on Web (use loadMem instead).
  • Future<AudioSource> loadUrl(String url, {LoadMode mode = LoadMode.memory, http.Client? httpClient, bool autoDispose = false}) — downloads the file, then loads it (temp file on native, loadMem on Web). Non-200 status throws SoLoudNetworkStatusCodeException. Pass your own http.Client when loading many URLs at startup — otherwise a new client is created per call. On Web the request is subject to normal CORS rules.
  • Future<AudioSource> joinTwoSources(String path, Uint8List bufferLeft, Uint8List bufferRight, {bool autoDispose = false}) — builds one stereo AudioSource from two buffers (bytes of supported audio files). Non-mono input is converted to mono on the native side; both sides are resampled to the engine sample rate; if lengths differ, the shorter side is padded with silence to match the longer. Always loads fully into RAM (LoadMode.memory), no mode parameter.
LoadMode
dart
enum LoadMode {
  memory, // decode entire file into RAM: less CPU, low latency, fast seek
  disk,   // stream chunks from the file: less RAM, more CPU
}

Use memory (the default) for sound effects and anything you seek. Use disk for large background music — but note that with disk mode, seeking lags with MP3s.

Supported formats:

  • Core formats: MP3, WAV, OGG (Vorbis/Opus/FLAC), FLAC.
  • OS-native formats (via platform decoders on macOS, iOS, Android, Windows, Web, Linux): M4A, MP4 (audio tracks), AAC, AC-3 (Dolby Digital), and E-AC-3 (Dolby Digital Plus). Linux note: On Linux, decoding these formats requires FFmpeg shared libraries (libavcodec and libavformat) installed on the host system (e.g. sudo apt install ffmpeg libavcodec-extra, sudo pacman -S ffmpeg, or sudo dnf install ffmpeg-free). Core formats work out of the box without FFmpeg.

[!NOTE] MP4 and M4A containers are supported for file, asset, URL, and memory loading, but are NOT supported for chunk streaming (setBufferStream/setPullBufferStream). For real-time streaming, use elementary streams such as AAC ADTS, AC-3, E-AC-3, OGG, MP3, WAV, or raw PCM.

AudioSource lifecycle

AudioSource cannot be constructed directly; loaders return it.

  • await SoLoud.instance.disposeSource(source) — stops all handles of the source and reclaims memory. Never play() a disposed source.
  • await SoLoud.instance.disposeAllSources() — disposes everything loaded (not needed at engine shutdown).
  • SoLoud.instance.isValidAudioSource(source) — true while the source is loaded.
  • source.autoDispose (settable property or loader parameter) — when true, the source is disposed automatically once all its handles finish. Ideal for one-shot SFX; don't use for sources you replay.
  • source.soundPath — the parameter (file path, asset key, URL, or buffer identifier) used to load this audio source ('' for waveforms/speech).
  • source.tempFilePath — the path to the temporary file created on disk when loading an asset or URL on native platforms ('' if none was created).
  • source.handles — unmodifiable set of SoundHandles of currently playing instances.
  • source.soundEvents — broadcast stream of ({SoundEventType event, AudioSource sound, SoundHandle handle}) records. SoundEventType has only handleIsNoMoreValid (a handle finished or was stopped) and soundDisposed.
  • source.allInstancesFinished — stream that fires each time the count of playing instances drops to zero; the safe-dispose signal:
dart
source.allInstancesFinished.first.then((_) {
  SoLoud.instance.disposeSource(source);
});
SoLoud.instance.play(source);
Show full SKILL.md (444 more words)Show less
Parallel loading

Wrap loaders in Future.wait (or .wait) — measurably faster than sequential awaits (20–40% per the docs):

dart
final [click, music] = await [
  SoLoud.instance.loadAsset('assets/click.wav'),
  SoLoud.instance.loadAsset('assets/music.ogg', mode: LoadMode.disk),
].wait;
Errors

All loaders throw SoLoudException subclasses (sealed base class). Catch the specific ones:

dart
try {
  final source = await SoLoud.instance.loadUrl(url);
} on SoLoudNotInitializedException {
  // call SoLoud.instance.init() first
} on SoLoudNetworkStatusCodeException catch (e) {
  // loadUrl: non-200 HTTP status
} on SoLoudFileNotFoundException {
  // loadFile: no file at that path
} on SoLoudFileLoadFailedException {
  // unreadable or unsupported format
} on SoLoudTemporaryFolderFailedException {
  // loadAsset/loadUrl: couldn't write the temp copy
}

loadAsset with a missing asset key throws the same FlutterError as AssetBundle.load — not a SoLoudException.

Traps

  • Loading is not playing. Coming from audioplayers, loadAsset does not emit sound. You must still call SoLoud.instance.play(source).
  • loadMem takes encoded file bytes, not PCM. Passing raw PCM samples yields a load failure. (For PCM there are separate buffer-stream APIs — outside this skill's scope.)
  • loadFile throws/is unsupported on Web. On Web always go through loadMem (get bytes from rootBundle, http, or a file picker).
  • Web CORS applies to loadUrl. A URL that plays fine on mobile can fail in the browser if the server doesn't send CORS headers; this surfaces as a fetch error, not a SoLoud error code.
  • AC-3 / E-AC-3 on Web: AC-3 and E-AC-3 audio formats are not supported on the Web platform in any browser. Chrome and Firefox lack Dolby licensing, and Safari's WebCodecs engine rejects raw AC-3 frames with Cocoa decoding errors, while Web Audio API does not decode raw .ac3 files. Attempting to load AC-3 or E-AC-3 on Web returns PlayerErrors.audioFormatNotSupported. For web audio, use MP3, WAV, OGG/Opus, FLAC, or AAC.
  • Temp-file eviction on mobile. loadAsset/loadUrl copy to the OS temp directory (SoLoudLoader-Temp-Files). The OS may purge it between load and play, causing a rare crash. If the gap between load and play can be long, prefer loadMem with LoadMode.memory.
  • Playing a disposed source fails. After disposeSource, do not play() that AudioSource again — check with isValidAudioSource if unsure. Same after autoDispose has fired.
  • autoDispose + looping never fires. A looping handle never finishes, so the source is never auto-disposed until every handle is stopped.
  • Re-loading the same path is a no-op. The second call logs a warning and returns a source for the already-loaded sound. Load once, reuse.
  • MP3 + LoadMode.disk seek lag. Documented native-side behavior; use LoadMode.memory if you need responsive seek().
  • disposeSource closes the event streams. After disposal, source.soundEvents/allInstancesFinished are closed — don't add listeners to a disposed source.

More depth

  • Demos/tests in the repo: example/tests/tests/load_mem.dart, example/tests/tests/join_two_sources.dart, example/tests/tests/auto_dispose.dart, example/tests/tests/all_instances_finished.dart, example/tests/tests/async_multi_load.dart. The main example app loads assets in example/lib/main.dart.
  • Loader internals (temp files, cleanup): lib/src/utils/loader_io.dart and lib/src/utils/loader_web.dart.
  • Exception hierarchy: lib/src/exceptions/exceptions.dart and siblings.

Keeping this skill current

This skill ships inside the flutter_soloud package, so upgrading flutter_soloud can carry a newer revision of it than the copy installed in the project. To check, run:

sh
dart run flutter_soloud:skills --check

It reports the installed and bundled skill versions and exits non-zero when an update is available. Offer to update with dart run flutter_soloud:skills (which touches only the skills, never pubspec or build files).

© alnitak, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/flutter-soloud-loading of alnitak/flutter_soloud.

Open the folder on GitHubat commit 289697e

Compare with similar skills

Flutter SoLoud Audio Loading next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Flutter SoLoud Audio Loading compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Flutter SoLoud Audio Loading this skillalnitak/flutter_soloud424—~2.6kAutomated safety check: NotesMIT
Flutter Pub ReleaseMixinNetwork/flutter-plugins512—~1.3kAutomated safety check: PassMIT
Liquid Glass Widgetssdegenaar/liquid_glass_widgets711—~3.8kAutomated safety check: PassMIT
Flutter Bloc and Cubitandrewyng/context-hub14k—~998Automated safety check: PassMIT
Solidnank1ro/solid165—~3.1kAutomated safety check: PassMIT
Sync Cbl Docscbl-dart/cbl-dart152—~2kAutomated safety check: PassApache-2.0

Similar skills

  • Flutter Pub Release

    MixinNetwork/flutter-plugins

    Prepare and draft a pub.dev release for a package in the flutter-plugins monorepo.

    512 GitHub stars~1.3k tokensUpdated 1 mo ago
    MobileAuto-check passed
  • Liquid Glass Widgets

    sdegenaar/liquid_glass_widgets

    Mastery guide and architectural rules for liquidglasswidgets.

    711 GitHub stars~3.8k tokensUpdated yesterday
    MobileAuto-check passed
  • Flutter Bloc and Cubit

    andrewyng/context-hub

    Helps choose between Bloc and Cubit in Flutter and sets defaults for packages, lifecycle, widget binding and tests.

    14k GitHub stars~998 tokensUpdated 4 mo ago
    MobileAuto-check passed
  • Solid

    nank1ro/solid

    PRIORITY — read this skill FIRST before writing Dart code when pubspec.yaml declares solidannotations or solidgenerator.

    165 GitHub stars~3.1k tokensUpdated 1 mo ago
    MobileAuto-check passed
  • Sync Cbl Docs

    cbl-dart/cbl-dart

    Sync a Couchbase Lite for Dart documentation page with the official Couchbase Lite docs.

    152 GitHub stars~2k tokensUpdated 11 days ago
    MobileAuto-check passed
  • Flutter Expert

    FNOSP/FlyNarwhal

    A skill your agent uses when building cross-platform applications with Flutter 3+ and Dart.

    495 GitHub starsUsed in 2 repos~758 tokens
    MobileAuto-check passed

More from alnitak/flutter_soloud

All 14 skills in this repo
  • Flutter SoLoud Audio Filters

    alnitak/flutter_soloud

    Explains how to add and tune flutter_soloud's 13 audio filters at global, per-sound and mixing-bus level, including activation order and parameter fades.

    424 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • flutter_soloud Mixing Buses

    alnitak/flutter_soloud

    Teaches flutter_soloud mixing buses for routing groups of sounds through shared sub-mixes with collective volume and filters, such as separate music, SFX and UI sliders.

    424 GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • flutter_soloud Setup

    alnitak/flutter_soloud

    Walks through adding the flutter_soloud audio engine to a Flutter app, with per-platform setup, initialization, binary-size and logging options, and output device switching.

    424 GitHub stars~3.6k tokensUpdated today
    Auto-check: notes
  • Teaches the push buffer-stream API of flutter_soloud for playing audio that arrives in chunks, such as icecast radio, WebSocket PCM feeds or streaming TTS, instead of a complete file.

    424 GitHub stars~2.5k tokensUpdated today
    Auto-check passed
  • Shows how to build audio visualizers in Flutter with flutter_soloud, using live FFT and wave data or offline waveform extraction, plus volume readings for level meters.

    424 GitHub stars~2.5k tokensUpdated today
    Auto-check passed
  • Flutter Soloud 3D Audio

    alnitak/flutter_soloud

    Teaches positional (3D) audio in fluttersoloud — play3d/play3dClocked/play3dScheduled, listener position/orientation/velocity, per-source attenuation and Doppler, and the per-frame update pattern.

    424 GitHub stars~2.2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Flutter SoLoud Audio Loading

What does Flutter SoLoud Audio Loading do?

Explains how to load audio in flutter_soloud with loadAsset, loadMem, loadFile and loadUrl, pick a load mode, and dispose sounds correctly on every platform. flutter_soloud works differently from audioplayers or just_audio: you load bytes into the SoLoud engine, get an `AudioSource` handle, play it as many times as you like, and dispose it yourself.instance`, which all need `init()` first or they throw `SoLoudNotInitializedException`.

When should I use Flutter SoLoud Audio Loading?

Flutter SoLoud Audio Loading fits situations like: loading an audio asset, file, URL or byte buffer in a Flutter app; debugging a flutter_soloud load error or a sound that never plays; making audio loading work on Flutter web despite its restrictions; cleaning up loaded sounds so native memory is released.

How do I install Flutter SoLoud Audio Loading in Claude Code?

Run `npx skills add alnitak/flutter_soloud --skill flutter-soloud-loading -a claude-code`. Or copy the skill folder (skills/flutter-soloud-loading in alnitak/flutter_soloud) into .claude/skills/flutter-soloud-loading in your project. Claude Code loads it when a task matches its description.

How do I install Flutter SoLoud Audio Loading in Codex?

Run `npx skills add alnitak/flutter_soloud --skill flutter-soloud-loading -a codex`. Or copy the skill folder (skills/flutter-soloud-loading in alnitak/flutter_soloud) into .agents/skills/flutter-soloud-loading in your project. Codex loads it when a task matches its description.

Can I use Flutter SoLoud Audio Loading in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add alnitak/flutter_soloud --skill flutter-soloud-loading -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/flutter-soloud-loading, .gemini/skills/flutter-soloud-loading, .github/skills/flutter-soloud-loading and .opencode/skills/flutter-soloud-loading in your project.

What does Flutter SoLoud Audio Loading need to run?

Going by SKILL.md and its folder, Flutter SoLoud Audio Loading needs the command-line tools its instructions call (dart, apt and dnf). Our summary lists: A Flutter project using the `flutter_soloud` plugin.

Does Flutter SoLoud Audio Loading access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Flutter SoLoud Audio Loading safe to install?

Our automated static check of SKILL.md found notes only (runs commands with sudo), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Flutter SoLoud Audio Loading use?

Flutter SoLoud Audio Loading is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Flutter SoLoud Audio Loading use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Flutter SoLoud Audio Loading?

Skills that share tags, products or a category with Flutter SoLoud Audio Loading: Flutter Pub Release (MixinNetwork/flutter-plugins, 512 stars), Liquid Glass Widgets (sdegenaar/liquid_glass_widgets, 711 stars), Flutter Bloc and Cubit (andrewyng/context-hub, 14k stars) and Solid (nank1ro/solid, 165 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Flutter SoLoud Audio Loading?

alnitak (a GitHub user) maintains it in alnitak/flutter_soloud, which has 424 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on October 6, 2026.

Source: alnitak/flutter_soloud on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.