Custom audio DSP in Flutter
Builds custom C, C++ or Rust audio effects and synths for flutter_soloud, beyond what the built in filters do.
Claude's review
7/10 Deep, accurate guide to custom DSP callbacks in flutter_soloud with real time and planar buffer rules.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Teaches how to build, compile, and bind custom synchronous C/C++/Rust audio generators (SoLoudSourceDspCallback_t) and real-time DSP filter effects (SoLoudFilterDspCallback_t) in flutter_soloud using Dart Native Assets (hook/build.dart), manual CMake/Cargo compilation, package:ffigen, and Web dart:js_interop. Use when the user asks to write custom DSP algorithms or effects the built-in filters do not provide (custom distortion, bit crusher, ring modulator, physical-model or chiptune synth, engine/weapon sound generator), custom synthesizers/oscillators in C or Rust, compile native audio callbacks with build hooks, generate FFI bindings with ffigen, or create custom audio sources or custom filter slots (createCustomAudioSource, filters.customFilter).
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: flutter-soloud-custom-dsp
version: 3
description: Teaches how to build, compile, and bind custom synchronous C/C++/Rust audio generators (SoLoudSourceDspCallback_t) and real-time DSP filter effects (SoLoudFilterDspCallback_t) in flutter_soloud using Dart Native Assets (hook/build.dart), manual CMake/Cargo compilation, package:ffigen, and Web dart:js_interop. Use when the user asks to write custom DSP algorithms or effects the built-in filters do not provide (custom distortion, bit crusher, ring modulator, physical-model or chiptune synth, engine/weapon sound generator), custom synthesizers/oscillators in C or Rust, compile native audio callbacks with build hooks, generate FFI bindings with ffigen, or create custom audio sources or custom filter slots (createCustomAudioSource, filters.customFilter).
---
# Custom Audio Sources & Custom DSP Filters in flutter_soloud
`flutter_soloud` allows developers to implement synchronous, zero-latency **Custom Audio Sources** (audio generators/synthesizers) and **Custom DSP Filter Slots** (effects like distortion, saturation, equalizers, reverbs, or delays) in native code (C, C++, Rust) or Web (`dart:js_interop`) without modifying `flutter_soloud`'s engine source code.
---
## 1. Core Architecture & Thread-Safety Rules
### Why Callbacks Run in Native / Web Code (Not Dart)
SoLoud's audio rendering loop executes on a dedicated, high-priority **OS real-time audio thread** (managed by `miniaudio`).
In Dart FFI:
- `NativeCallable.isolateLocal` can **only** be called from the OS thread hosting that Dart isolate. Calling it from the real-time audio thread causes the Dart VM to immediately abort/terminate the process.
- `NativeCallable.listener` posts asynchronous events back to the Dart event loop; it cannot return synchronous audio buffers before the hardware DMA buffer deadline.
Therefore:
- **Native Platforms (macOS, iOS, Android, Windows, Linux)**: Audio callbacks are written in C, C++, or Rust, compiled into a native library, and passed to SoLoud as raw 64-bit function pointer memory addresses (`int callbackAddress`).
- **Web (WASM)**: Audio callbacks are written in JavaScript or Dart via `dart:js_interop` attached to `globalThis`, and passed to SoLoud by function name (`String webJsFunctionName`).
### Hard Real-Time Audio Constraints
Inside your audio callbacks:
1. **Never allocate or deallocate heap memory** (`malloc`, `free`, `new`, `delete`, `std::vector::push_back`, etc.). All persistent state must be pre-allocated inside a custom state struct passed via `userData`.
2. **Never lock blocking synchronization primitives** (`std::mutex`, `pthread_mutex`, condition variables, semaphore waits). Use lock-free atomics (`std::atomic` in C++, `stdatomic.h` in C, `std::sync::atomic` in Rust) or single-producer single-consumer (SPSC) ring buffers.
3. **Never perform I/O** (no `printf`, no file reads/writes, no network sockets, no system calls).
4. **Never call into the Dart VM or invoke Dart isolate ports**.
---
## 2. Audio Buffer Layout: Planar (De-Interleaved)
SoLoud does **NOT** use interleaved audio buffers (`[L0, R0, L1, R1, ...]`). Instead, it uses **planar (de-interleaved)** memory layout: each audio channel is laid out in a contiguous array separated by `aBufferSize` elements:
```
aBuffer + 0 * aBufferSize -> [ L0, L1, L2, L3, ... L(N-1) ] (Channel 0 - Left)
...From alnitak's repository, MIT licence.
Related skills
-
Checked
Android Gradle Plugin upgrade
Moves Kotlin Multiplatform projects to Android Gradle Plugin 9 and fixes the build failures it causes.
8/101 credit -
Checked
CocoaPods to SwiftPM
Moves Kotlin Multiplatform projects from CocoaPods to Swift Package Manager and updates the Xcode project.
8/101 credit -
Checked
Kotlin Native build speed
Diagnoses and fixes slow Kotlin/Native iOS builds in Kotlin Multiplatform projects, both locally and on CI.
7/101 credit -
Checked
SwiftUI Liquid Glass
Adds and reviews Liquid Glass in SwiftUI apps for iOS 26, avoiding pitfalls with bars, buttons and scrolling.
7/101 credit -
Checked
Native Mobile App Design
Designs Expo and React Native screens that feel truly native, with proper navigation, motion and dark mode.
7/101 credit -
Checked
Offline Android LLM apps
Builds an Android app that runs an open LLM on the phone with LiteRT, so it works without a server.
7/101 credit