Skip to Content
Soundor Skills

soundor-plugin-architecture

Makes the structural decisions of a Soundor audio plugin.

pnpm dlx skills add soundor/skills --skill soundor-plugin-architecture

SKILL.md on GitHub

When an agent uses it

Makes the structural decisions of a Soundor audio plugin. Decides what belongs in the UI, the Rust controller and the Rust processor, and whether a value is a parameter, persistent state, a native stream, an audio resource, a native method or UI state; covers stable parameter ids, ranges and mappings, automation and gestures, saving and restoring sessions, presets, backward compatibility, channel layouts, MIDI, latency, bypass, instances and the plugin lifecycle. Use when designing a plugin, adding a parameter or feature, or changing anything a saved session, a DAW or another layer depends on.

Instructions

Decide where each piece of a plugin lives before writing it. A wrong choice compiles and even works on first try, then breaks automation, loses users' sessions, or glitches the audio.

Work from the installed version

Soundor is pre-1.0; mechanisms are added and refined between minor releases. Before relying on one, confirm it in the project's installed version, in this order: skills bundled in installed Soundor packages (find node_modules/soundor node_modules/@soundor -name SKILL.md, none ship yet), the generated contract (.soundor/generated/*.d.ts and .soundor/generated/rust/soundor/src/, written by npm run gen), the packages' .d.ts files, then https://soundor.dev/docs (agent index at https://soundor.dev/llms.txt). What Soundor supports separates general plugin practice from what Soundor 0.21 implements; never promise a capability the installed version lacks.

The three layers

LayerWhereThreadDoes
UIsrc/, ReactUI thread, editor onlyShows and edits; exists only while the editor is open
Controllerlib/src/controller.rscontrol threadNative methods, async work, loading data, publishing resources
Processorlib/src/processor.rsaudio threadAudio and MIDI, under a deadline, every block
  • The processor never waits for anything. It reads parameters, audio state and resources, and writes audio, MIDI, read-only parameters and streams.
  • The controller exists once per plugin instance, editor open or not. It has the same parameters, state, History and presets as the UI, and can publish audio resources. It cannot reach the processor's fields.
  • The UI can close at any moment and reloads on every change during development: React state is lost each time. Anything that must survive belongs in a parameter, state, or storage.

Choose the mechanism

The value…Use
is a control the DAW can automate or show (gain, cutoff, mode)parameter
is a control hosts must not automate (oversampling factor)parameter, access: 'manual'
is measured by the processing and shown to the host (GR meter)parameter, access: 'readOnly'
is session data that is not a single number (band list, names)state
is session data the processor needs (a step pattern, a mode)state with audio: true
changes constantly and the UI shows its latest (level, spectrum)native.streams
is large immutable data the processor reads (wavetable, IR)native.resources
is a request from the UI that does work (load a file, analyze)native.methods, async when slow
is a notification from native code to the UInative.events
is a user preference shared by every instancesoundor:storage
is files: user presets, samplessoundor:fs
only matters while the editor is open (hover, selected tab)React state

How the layers communicate gives each mechanism's threads, timing, cost, and whether it is saved, automated, part of presets and undoable.

Rules that protect users' sessions

  1. Ids are permanent. plugin.id, parameter keys, state field names and choice option order are what hosts and sessions store. Rename a label freely; never an id. Add choice options only at the end.
  2. Ranges and mappings are part of the contract. DAW automation is recorded in normalized positions, so a new range or mapping changes what existing automation does, and a saved value outside a narrowed range is clamped on restore. Treat such a change as a migration.
  3. The processor owns smoothing. Parameters arrive once per block; ramp or filter them in the processor, never in the UI.
  4. Gestures wrap drags. beginGesture() on press, set() while moving, endGesture() on every exit path. Discrete changes need no gesture.
  5. Restoration is the normal path. Every instance can be created, restored from a session, prepared at any sample rate and block size, reset and destroyed, with no editor ever opened.

Parameters covers types, ranges, mappings, text formatting, groups, bypass and automation. State, presets and compatibility covers saving, restoring, presets, History and changing a released plugin.

Lifecycle, layouts and timing

  • prepare() gets the sample rate, the maximum block size, the negotiated layout and current parameters; it may run again at any time. Allocate here.
  • process() gets any block size up to the maximum, including zero.
  • reset() clears signal history (delay lines, filter state, voices) without freeing.
  • Each instance is separate: no globals, no statics with mutable DSP state.

Lifecycle covers channel layouts and buses, MIDI, latency and tail, bypass, threads, multiple instances and the editor's lifecycle.

Before you finish

  • Every value is in the layer and mechanism the tables above give.
  • No id, choice order, range or mapping of a released plugin changed without a migration plan the user agreed to.
  • The processor never waits on the UI or the controller.
  • The plugin works with the editor never opened: parameters, automation and restored state all reach the audio.
  • Tests cover what a saved session relies on (the soundor-testing skill says how), and the claims you make about host behavior were checked against the installed version.

References

The skill reads these when a task needs them:

On this page