# Maru - agent guides > Generated from the agent-tools knowledge cards. Index: https://maru.audio/guides/llms.txt # Plan sound and face together > Joint brief and UI-first execution: control contract, working PluginUI face, DSP integration and independent sound/UX/design proof. When to read: Read first for a new module or combined DSP-and-UI request, and before choosing a starter/DSP, replacing its engine or changing signal/control wiring. Guide id: `project-planning` (`maru guide read project-planning` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Before creating a module, replacing its engine or changing wiring, discover owners, starters, DSP and guides. Save one joint brief in the project’s Markdown notes before implementation. For every new module or combined DSP-and-UI request, read `face-from-reference` and `ui-kit-faces` now: record player tasks, art direction and shared component choices alongside intended DSP/control behavior. Default to a UI-first sequence: control contract -> working PluginUI face -> DSP integration -> end-to-end proof. Choose the owner before scaffolding; keep fixes proportional. This adds no approval pause. ## Decision tree 1. **Does an existing project own the behavior?** Extend that owner or the authorized source remix. Do not create a parallel project for convenience. 2. **Do existing modules supply the result?** Compose their declared ports through the module/rack contract, never private DSP or sound made in a face. 3. **Otherwise classify I/O before choosing a starter:** | Goal | Starting route | | --- | --- | | Transform audio | `processor-effect`; Graph `effect` if registered nodes supply the entire behavior. | | Play sound from notes | `processor-instrument`; Graph `instrument` only if its registered nodes fit the entire instrument. | | Sound without note input | A Processor with `defineGenerator`; no dummy MIDI input. | | Sequence/route/transform MIDI | An event Processor with the matching public declaration; audio output may be zero. | | Explore a face | The correct instrument/effect starter in `maru dev .`, with temporary sound/state-only controls labeled. | Discover kinds with `maru init --help`; read the starter's `README.md` and `src/index.ts`. If no kind fits, adapt its declaration/ports before use; record the gap, never retain fake ports. 4. **Do registered nodes express every required algorithm, event, state and resource behavior on the intended targets?** If yes, a Graph fits. Otherwise use a Processor over public DSP. Read `graph-authoring` or `processor-authoring` accordingly. 5. **Which DSP fits the musical requirement?** Compare public voices/modules with smaller leaves, including consumers and tests. Read `dsp-leaf-catalog`; for an instrument read `instrument-sound-design`. Check tuning, envelopes, identity, polyphony, smoothing, resources, rates, channels and intended targets. Record the choice and rejected alternatives. Do not silently substitute a different synthesis/model/resource approach. 6. **What is missing?** Name the capability and owner. Extend its public contract with tests; keep product behavior in the project. Prove risks without a second browser engine or unsupported target promises. ## Trace the wiring and prerequisites Write the paths the project actually needs: ```text Host MIDI/pattern -> declared input -> shared ingress -> module voices/events Host audio/prepared resource -> declared bus/slot -> module processing Schema/preset/CC -> host parameter writer -> Processor setter and face values Module output -> host output; Processor visualization -> face ``` Name ports/channels, note identity, units, timing, state ownership and consumers. Read `midi-and-event-modules`, `assets-and-resources`, `parameters-and-schema` and `ui-kit-faces` as needed. The host owns devices, file/resource access, presets, CC and output. The face never creates audio or a second parameter host. A declared port or an MPE switch alone does not prove that input reaches the voice. ## Execute and reconcile Record outcome/targets, owner/starter, Graph/Processor, DSP evidence, wiring, player tasks/art direction/components, budgets and ordered checks. Include resource licenses/loading, voice/event capacity, rates/blocks, headroom, smoothing, CPU/memory and latency/tail. Mark assumptions and target gaps. First build and inspect the actual React face from PluginUI primitives using the provisional schema and host-controlled preview values. Verify composition, control behavior and min/default/max sizes before deep DSP. Keep temporary sound/state-only status in project notes. For a concrete feasibility risk, run a small DSP probe early and feed its constraints back; do not let it absorb design. Then implement DSP and connect the same face through its contract; preserve the chosen composition and shared interactions. Prove input/clock -> processing -> output, parameter/preset round-trip and stop/reset (`build-preview-export`). State-only controls and passthrough never complete a combined request. At the DSP-to-design handoff, verify schema units/ranges/defaults/taper, signal/control flow, choices/actions/state, presets and available host capabilities. Name real observable data for each display. Reconcile the face and brief after DSP changes; remove stale controls and invented telemetry. Check sound, UX behavior and aesthetic quality independently; report measurement and listening separately. --- # Processor authoring > The Processor lifecycle, block, imports and templates, with the instrument sound-design reading path. When to read: Read before writing or changing DSP in src/dsp/processor.ts, or when starting a new module. Guide id: `processor-authoring` (`maru guide read processor-authoring` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt A Processor is target-neutral DSP written as restricted TypeScript in `src/dsp/processor.ts`. It is the default implementation for product DSP: one source builds for the browser, WebAssembly and native plug-in targets. Target and plug-in format names never belong in the algorithm. Read `project-planning` before choosing the starting point or wiring. For an instrument, `instrument-sound-design` owns the sound recipe and playability checks. A template’s held tone is not musical acceptance. ## Declaring it In `src/index.ts`: ```ts implementation: { kind: "processor", source: "src/dsp/processor.ts", } ``` Optional fields: `parameterEventTiming` (`"sample-offset"`, the default, or `"block-start"`); `maxEvents`, `maxEventOutputs`, `maxVoices`, `noteIdentity` and `midiDialect` (see `midi-and-event-modules`); `resources` (see `assets-and-resources`). **Channel count.** `defineEffect` is mono unless the declaration sets `channels: 2` (or `inputChannels` / `outputChannels` for an asymmetric effect). A `prepare` that accepts stereo does not make the module stereo, and `maru module check` passes on a mono declaration, so set it for any stereo effect. The qualification input tape then needs one channel per input channel. The declaration may also set `state: { version, maxBytes }` (with `saveState`/`restoreState`) and `processing: { maxBlockFrames, maxTailSeconds }`; the tail is in seconds. ## The contract `src/dsp/processor.ts` ends with a default export satisfying `ProcessorDefinition` from `maruaudio/dsp/processor`: ```ts const processor = { createState, prepare, setParameter, process, reset, } satisfies ProcessorDefinition export default processor ``` | Member | Signature | Role | |---|---|---| | `createState` | `() => State` | Allocate all storage, sized for the highest supported rate (`MAX_PROCESSING_RATE`) where size scales with rate. | | `prepare` | `(state, spec: ProcessSpec) => boolean` | Derive rate-dependent values from `spec.sampleRate`; check `maximumBlockSize`, `inputChannels`, `outputChannels`. Return `false` to refuse. | | `setParameter` | `(state, path: string, value: number) => boolean` | Apply one schema `path`. Floats stay numeric, booleans are `0`/`1`, enums are option indices. | | `process` | `(state, block: ProcessorBlock) => boolean` | The realtime callback. Allocates nothing. | | `reset` | `(state) => void` | Clear transient state so a reset instance renders exactly like a fresh one (the check probes this). Schema defaults are reapplied afterwards. | Schema defaults arrive through `setParameter` after `prepare` and after `reset`; do not hard-code them in `createState`. Optional members, each omitted when not needed: - `handleEvent` / `handleMidi` / `emitEvents` — MIDI in and out; see `midi-and-event-modules`. - `loadResource(state, slot, bytes, length)` — host-prepared content; see `assets-and-resources`. - `saveState(state, out) => number` / `restoreState(state, bytes, length)` — authored state; declared together; see `presets-and-state`. - `applyCommand(state, command, length)` — a face-authored command applied at a block boundary; requires `implementation.maxAuthoredCommandBytes`. - `visualize(state, out) => number` — a control-rate frame for the face; requires `implementation.visualization`. ## The block `ProcessorBlock` is a caller-owned planar view: `input`, `output`, `inputChannels`, `outputChannels`, `channelStride`, `frameOffset`, `frameCount`. Channel zero begins at `frameOffset`, channel one at `channelStride + frameOffset`. Write only the `frameCount` current frames. An `outputChannels: 0` processor is event-only: `process` still runs, but `output` must not be written. ## Imports a Processor may make Files inside the module's own package, and `maruaudio/dsp//` subpaths (see `dsp-leaf-catalog`). Write your own helpers under `src/dsp/`. ## Golden example `maru init --kind processor-effect` writes the reference Processor effect — a soft drive into a one-pole tone control: - `src/index.ts` — `defineEffect` with the `implementation` literal above. - `src/contract.ts` — the parameter schema the declaration and the DSP share. - `src/dsp/processor.ts` — imports `maruaudio/dsp/math/range`, `/filters/one-pole` and `/processor`; `createState` allocates once, `prepare` accepts only mono or stereo, `process` loops over the block. - `src/ui/` — the face. `maru init --kind processor-instrument` is the instrument counterpart: eight velocity-sensitive oscillator/ADSR voices with independent release, smoothed level/sustain and note transitions. Keep those guarantees when changing the sound. It is a starting synth, not the requested product model. Check the work with `npm run typecheck` and `maru module check . --portability` (see `build-preview-export`). --- # Instrument sound design and DSP selection > Instrument sound recipes, DSP candidate selection, voice transitions, gain headroom and playability evidence before audition. When to read: Read before choosing or changing an instrument's DSP, diagnosing harshness, clicks or dropouts, or handing off a sounding prototype. Guide id: `instrument-sound-design` (`maru guide read instrument-sound-design` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Use `project-planning` first to choose the owner, starter, processing shape and wiring. The sound recipe below refines that plan. Record a short sound recipe in the project: target register and articulation, mono/poly behavior, velocity/pressure/bend meaning, attack/release, maximum voices and tails, per-voice level and output headroom. Compare the closest existing public voice with a composition of smaller leaves; read `dsp-leaf-catalog` before choosing. Retain the selected imports, a working consumer/example, relevant tests, gaps and reasons for rejecting alternatives. Use the highest-level composition that fits, rather than rebuilding proven voice behavior from a bare oscillator. Keep product-specific behavior in the project and reusable missing capabilities with their shared owner. Read the implementation, not just its name: a polyphonic voice may still reset an envelope on same-note retrigger; an allocator does not supply click-free stealing; gain smoothing does not repair a phase reset. Verify initialization, sample-rate preparation, note identity, release, expression, reset and every live setter. Choose response times for the gesture; do not smooth away finger vibrato. Check the sum at maximum polyphony/pressure, including release tails and resonant buildup, before adding output protection. A limiter does not repair discontinuous events or unstable feedback. A physical model needs justified excitation, resonating storage, losses and coupling. An oscillator with a named preset does not supply these. Preserve primary references and any code/asset licenses, and distinguish acoustic behavior from intentional expressive extensions. ## Candidates to inspect These public leaves are starting points, not a ranking or interchangeable recipes. Confirm each API in the current `dsp-leaf-catalog`. | Need | Public leaf family | Check before use | | --- | --- | --- | | Established synth behavior | `voices/oscillo`, `voices/subtractive`, `voices/fm-keys` | Internal polyphony, tuning, velocity, stereo layout, level and retrigger policy. | | Voice ownership and performance | `voices/polyphonic-pool`, `voices/mono-performance`, `voices/portamento` | These handle allocation/policy/glide; they do not replace the voice's DSP or guarantee continuous stealing. | | Moving controls and event edges | `modulation/slew`, `mixing/levels` | Gain smoothing, exact pitch ramps and note-transition bridges solve different discontinuities. | | Resonating bodies | `physical/modal-resonator-bank`, `physical/modal-radiation` | Supply justified modes, losses and excitation/coupling. A resonator alone is not a friction model. | ## Before handing off a sounding prototype Render the actual Processor, including isolated low/middle/high notes, velocity endpoints, repeated notes, overlapping chords with independent releases, equal-pitch identities where supported, and voice stealing. Exercise pressure to/from zero, abrupt parameter changes, dense CC streams and live bend/vibrato where supported. Check note-off tails, preset changes while sounding, stop/panic and reset. Include required sample rates and event-split block partitions. Add a regression that reproduces each repaired artifact. Measure both channels over the full render: finite samples, peaks, clipping, RMS/DC, discontinuities and unintended gaps. Choose thresholds suited to the sound; inspect event boundaries rather than excluding every onset from click detection. Inspect aliasing and reference spectra where relevant. Verify the fresh generated Program in `maru dev .` with pattern playback, CC, presets and the real face. Record the artifact identity and what was exercised. A successful build, a finite held tone or matching backend hashes does not establish musical quality. Report measured health, reference comparison and listening separately. Keep automated checks muted; provide a short audition capture or the workbench for the owner's listening, and say when listening has not occurred. See `build-preview-export` for target qualification. `maru init --kind processor-instrument` provides `src/dsp/processor.ts`, a working voice-transition example. Its initial voice is a starting point, not the requested product model. --- # Restricted TypeScript in a Processor > The rules a Processor source must obey: no allocation in process, the ** ban, the Math allowlist, bounded loops, block-size invariance. When to read: Read before writing any Processor DSP, and whenever a portability or Math-surface diagnostic appears. Guide id: `restricted-typescript` (`maru guide read restricted-typescript` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt One Processor source must render identically on every target. The rules below are checked by the toolchain, so a violation is a build failure with a named fix, not a style note. ## Realtime rules - `createState` allocates every buffer the instance will use, sized for the maximum block, voice count and `MAX_PROCESSING_RATE`. - `prepare` derives values from the `ProcessSpec` and may refuse by returning `false`. Allocate there only what cannot be sized in `createState`. - `process` (and `handleEvent`, `handleMidi`, `emitEvents`, `visualize`) performs **no allocation, locking, I/O, dynamic import, logging, unbounded work or JavaScript callback**: no `new`, no array or object literal, no closure creation, no `console`. - `loadResource`, `saveState` and `restoreState` allocate nothing either; they read and write buffers the host owns. - **Block-size invariance.** `process` must produce the same output for a given input however the caller splits it into blocks. Ramps and crossfades count samples, never blocks. - Do heavy work at block rate, not per sample: compute `exp`/`sin`/`pow` coefficients once per block and keep the sample loop simple. ## The `**` ban `a ** b` is rejected everywhere in the Processor source. **Write `Math.pow(base, exponent)`.** ## The Math surface Only these `Math` members exist in a Processor: **Functions**: `pow`, `exp`, `expm1`, `log`, `log1p`, `log2`, `log10`, `tanh`, `sinh`, `cosh`, `cbrt`, `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `atan2`, `floor`, `ceil`, `round`, `trunc`, `abs`, `sign`, `min`, `max`, `sqrt`, `fround`, `imul`. **Constants**: `Math.PI`, `Math.E`, `Math.LN2`, `Math.LN10`, `Math.LOG2E`, `Math.LOG10E`, `Math.SQRT2`, `Math.SQRT1_2`. **Rejected**, each with the replacement its diagnostic names: - `Math.hypot` — write Math.sqrt(x * x + y * y) explicitly - `Math.random` — a realtime Processor must carry its own seeded generator; Math.random cannot be reproducible across targets - `Math.clz32` — Math.clz32 is not part of the Processor math surface; compute the bit count explicitly - `Math.asinh` — write Math.log(x + Math.sqrt(x * x + 1)) explicitly - `Math.acosh` — write Math.log(x + Math.sqrt(x * x - 1)) explicitly - `Math.atanh` — write 0.5 * Math.log1p(2 * x / (1 - x)) explicitly `Math.pow` **is** available. A Processor that needs noise carries its own seeded generator (`maruaudio/dsp/noise/xorshift32`). ## Language subset - Every loop is bounded. Loop over the block's frames or to a constant (for example a voice pool's maximum) and skip inactive entries inside the body. - No closures, recursion or growing collections in the Processor source. - Records are exact structs: a value's shape is fixed where it is declared, and adding a property later is an error. - No `any`. - No `Int16Array`: declare `f32` resource slots and use `Float32Array`. ## Numeric hygiene - `Math.fround` where a value is written to a `Float32Array`. - Integer locals coerced with `| 0`. - Guard non-finite inputs: `value !== value` is the NaN test, and `maruaudio/dsp/math/range` exports `isFiniteNumber` and `clampUnit`. ## Checking your work `maru module check . --portability` builds the Processor for the compiled targets and reports any `**`, rejected `Math` member or realtime violation with file, line, column and the replacement to write. A file it cannot read is a failure, not a skip. For a complete lifecycle example, `maru init --kind processor-effect` writes `src/dsp/processor.ts`; inspect it alongside the restrictions above. --- # The `maruaudio/dsp` leaf catalog > Every maruaudio/dsp subpath that resolves, candidate selection by musical behavior and evidence, and the init/prepare/set/tick/reset convention. When to read: Read before importing a DSP leaf, or when deciding whether a primitive already exists. Guide id: `dsp-leaf-catalog` (`maru guide read dsp-leaf-catalog` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt A Processor imports only the leaves it uses, such as `maruaudio/dsp/filters/biquad`, not category barrels. ## The import shape Map leaf lifecycle to Processor: `init…` → `createState`, `prepare…SampleRate` → `prepare`, `set…` → `setParameter`, `…Tick` → `process`, `reset…` → `reset`. The `processor-instrument` starter demonstrates this with `maruaudio/dsp/envelopes/adsr` and `maruaudio/dsp/oscillators/polyblep`. `maruaudio/dsp/processor` holds the contract types (`ProcessorDefinition`, `ProcessSpec`, `ProcessorBlock`, `ProcessorEventOutput`), the `PROCESSOR_EVENT_*` constants and the rate helpers (`isProcessingRateSupported`, `PROCESSING_REFERENCE_RATE`, `MAX_PROCESSING_RATE`). Read `instrument-sound-design` before choosing leaves. Compare voices, examples and tests against the recipe; exports alone do not establish suitable retrigger, expression or sound-quality behavior. ## Every exported subpath Only listed subpaths exist. - **acoustics/** directivity, geometry, materials, materials-table, octave-bands, physics, ray-tracer, rir-analysis, rir-assembly, rir-builder, room-convolver, rounding, rt-tail, rt60, shoebox-ism, vec3, wall - **analysis/** k-weighting, loudness-match, loudness-meter, pitch-detector, pitch-tracking, programme-meter, resonator-pitch-tracker, true-peak, voice-pitch-detector - **circuit/** dk-solver, netlist, oversampled - **control/** host-transport, musical-clock, param-macros, step-sequencer-clock - **delays/** alignment, bounded, clocked-glitch, cross-feed, feedback, fractional, pcm16-interpolated, pcm16-ping-pong, ping-pong, primitives, reverse-delay, saturated-feedback, tap-pattern - **distortion/** bitcrusher, chebyshev, classic-amp, color-shaper, decimator, direct-overdrive, drive, jitter-reducer, octave-divider, oversampled-waveshaper, rational-soft-clip, sample-rate-reducer, taper, tone-shape, triode-stage, voiced-overdrive, voiced-wavefolder, wavefolder - **dynamics/** envelope-follower, follower-limiter, gate, keyed-compressor, lookahead-limiter, peak-compressor, plosive-repair, sidechain-duck, stereo-compressor, stereo-de-esser, stereo-expander, stereo-linked, stereo-transient-shaper - **envelopes/** adsr, grain-windows, linear-ar, overshoot-adsr - **filters/** bilinear, biquad, convolution, dc-block, dj-filter, envelope-filter, eq3, ir-player, kaiser-sinc, lfo-lowpass, multimode-cascade, one-pole, parametric-eq, partitioned-convolution, phase-delay, riaa, state-variable, stereo-high-lowpass, string-readout, tone - **math/** decibels, float-clamp, grid-coordinates, hash, integer, pcm16, permutation-six, pitch, precision, quantizer, range, ring-stack, scale - **mixing/** constant, constant-power-pan, control-gain, gain, gain-db, key-velocity-response, levels, mix, velocity - **modulation/** auto-panner, borrowed-rotary, chorus, f32-slew, flanger, glide, lfo, phaser, retune, slew, stereo-auto-panner, stereo-ring-modulator, tremolo, vibrato, warble - **neural/** nam-a2, nam-a2-resource-spec, nam-a2-spec - **noise/** coloured, mulberry32, newlib-rand, record-texture, xorshift32 - **oscillators/** band-limited-table, daisysp-blep, formant, lissajous-duo, polyblep, variable-shape, z - **physical/** bloom, bow-table, excitation-control, felt-hammer, jet-table, lip-reed, lip-valve, mallet, modal, modal-radiation, modal-resonator, modal-resonator-bank, modal-table, piano-scale, playability-map, reed-table, strike, struck, waveguide-mesh - **processors/** clip-player, division-clock, midi-note-map, midi-pattern, midi-timeline, mpe-ingress, multi-effect-chain, multi-effect-chain/{constants, control-mapping, controls, drive, dynamics, equalizer, filters, modulation, reverbs, slots, stereo-spectral}, pattern-arpeggiator, reference-smoothed-gain, serial-effect-stack, serial-effect-stack-reference, stem-player, strum-notes - **reverbs/** borrowed-hall-fdn, borrowed-spring, dattorro, griesinger, schroeder, stereo-dattorro, stereo-room-fdn, stereo-schroeder - **spectral/** band-split-vocoder-shifter, delay-pitch-shifter, frequency-shifter, phase-vocoder-shifter, phase-vocoder-stretcher, pitch-shifter, real-fft, split-vocoder-shifter, vocoder, voice-shifter, wsola-stretcher - **stereo/** pan, to-mono, width - **tables/** looped-region, sample-reader, tape-loop - **voices/** banded-waveguide, bowed-resonator, bowed-string, brass, chord-colour, chord-voicing, clarinet, clouds, coupled-strings, drum-kit-model, flute, fm-algorithms, fm-core, fm-keys, gamelan, gong, grain-pool, keymap, modal-struck, mono-performance, mouth, note-stack, oscillo, peaks, phase-7, plaits, pluck, polyphonic-pool, portamento, reed-wind, rings, round-robin, sampler-bus-slot, sampler-zone, saxophone, serial-voice-pool, shakers, sitar, stages, stiff-string-piano, subtractive, tetra-box, tonehole-clarinet, unison, warps, warps/{controls, stream} Contract modules with no leaves: `processor`, `processor-events`. ## When no leaf fits Name the missing primitive instead of approximating it with hand-rolled, unverified audio-rate DSP. Your own helpers under `src/dsp/processor.ts` (control-rate shapers, a product voice built from leaves) are fine. --- # Parameters and the schema > ParamDescriptor fields, parameter order as the host ABI, taper, sections and tiers, how one path binds the schema, the DSP, the face and presets, and how to read a module's parameter table. When to read: Read before adding, renaming, reordering or removing a parameter, before wiring a control, or before setting a module's parameters to shape a sound. Guide id: `parameters-and-schema` (`maru guide read parameters-and-schema` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt The schema is the only place a control is defined: the DSP, plug-in hosts, MIDI CC and the face all read it, so one knob position means one value. ## Where it lives `src/contract.ts` (or a `src/contract/` folder), imported by `src/index.ts` as the declaration's `schema` and by the DSP for its paths. A very small module may inline `schema: { params: [...] }` in `src/index.ts`. ## `ParamDescriptor` ```ts { path: "delay.time", // dotted path; ALSO the stable automation id label: "Time", // what a human reads group: "Delay", // section: a declared section id, or a group name type: "float", // "float" | "enum" | "bool" min: 0.001, max: 2, default: 0.25, step: 1, // omit for continuous units: "s", // display unit: "Hz", "dB", "ms", "s", "BPM" taper: "exp", // "linear" (default) | "exp" | "log" options: ["Low", "Band", "High"], // enum only defaultCc: 1, // optional: CC this answers to out of the box role: "host-tempo", // optional: "host-tempo" | "host-tempo-source" | "host-playing" display: { signed: true }, // optional readout hint: signed, format: "percent" description: "How long each repeat waits.", // optional: accessible description, tooltip shortLabel: "Time", // optional: ≤ 8 characters for hardware knobs tier: "primary", // optional: "primary" | "secondary" | "advanced" } ``` Write `min`, `max` and `default` for every float: normalization, hosts and the face all read them. ## Rules - **Parameter ORDER is the host ABI.** Append new parameters at the end; never reorder or remove one in a shipped module. - **`path` is the stable automation id.** Renaming a path breaks saved automation and presets. Change `label`, not `path`. - **The response curve is `taper`,** shared by host automation, MIDI CC and face knobs. Never fix a feel with a face curve or a DSP remap. `"log"` needs a strictly positive range. - A stepped control is a `float` with `step: 1` and integer `min`/`max`. - `type: "enum"` carries `options`, and the option ORDER is part of the contract: `setParameter` receives the option index. - At most one parameter per schema may carry any given `role`. - `display` changes the readout only, never the value. ## Sections and accessibility Group controls for people with an optional ordered tree on the schema, `sections: [{ id, label, description?, tier?, children? }]`, at most three levels. A parameter joins a section by naming its `id` in `group`; a `group` that names no section becomes its own section, so nothing is ever hidden. Sections never reorder parameters. Faces, hosts, controller pages and screen readers read this tree, so: - name sections after what they shape (Filter, Envelope, Output), never Main or Parameters, and order them along the signal path; - keep about 3 to 12 controls per section; nest instead of growing one list; - do not repeat the section in a label ("Cutoff" in Filter, not "Filter cutoff"); keep labels unique within a section; - give every time, frequency and level `units`, and a 0..1 amount `display: { format: "percent" }`; - add a one-sentence `description` where the label alone does not say what happens; - mark the few controls a musician reaches for first `primary` and set-and-forget ones `advanced`; hardware pages put primary first. The module check's `parameter-layout` row scores this 0 to 100 with rule ids and fixes; it never fails. To reorganize, work from its findings, change only `sections`, `group`, `label`, `shortLabel`, `tier`, `units`, `display` and `description`, and never a parameter's path, order, default or range. ## Reaching the parameter | Where | Binding | |---|---| | Processor | `setParameter(state, path, value)` switches on the same `path`. Floats stay numeric, booleans arrive as `0`/`1`, enums as option indices. Return `false` for an unknown path. | | Graph | `expose(path, node.params.x)` in the builder callback. | | Face | a `maruaudio/ui` control bound to the path (`faceParamBinding`). | | Preset | a `values` object keyed by the same paths. | Adding a control is a **two-place change**: the schema plus the `setParameter` case (or `expose` mapping); either alone is a dead control or an unreachable parameter. `npm run typecheck` catches a missing case in the template projects. ## Reading a module's parameters Read them with `maru module params` (operation `list_module_params`) or `read_module_spec`, never from the face. Results carry `description`, `shortLabel`, `tier` and the `sections` tree only where declared; the text lists sections in order, primary controls first. To shape a sound, start from primary controls and section descriptions, touch advanced ones only when asked, and name the section you changed. An absent field is undeclared: never invent one, nor describe a parameter you have not read. --- # Faces and `maruaudio/ui` > Controlled faces, semantic shared controls, PluginUI assemblies/themes, typography and honest visualization. When to read: Read before creating or editing any face in src/ui/, including MIDI tools, or choosing controls, actions, selectors, typography or themes. Guide id: `ui-kit-faces` (`maru guide read ui-kit-faces` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Read `face-from-reference` before any UI code. Reconcile controls after DSP edits. `ui.entry`: `src/ui/index.tsx`; sizes: `ui.minSize` / `ui.defaultSize` / `ui.maxSize`. ## Controlled face ```ts import type { AudioModuleFaceProps } from "maruaudio/contracts" import { FaceModuleNavbar, faceParamBinding, isFaceModulePowered, useFaceParamEditGesture, } from "maruaudio/ui/module-face-controls" ``` Render `values`; call `setParam(path, value)`, never local parameter state. `faceParamBinding(face, path)` supplies range, setter and schema taper; pass its `mapTo01`/`mapFrom01` to headless controls. `useFaceParamEditGesture(face)` wraps drags. Audio, devices and routing belong to the host. `live`, `audioReady` and `runtimeHealth` never gate audio. `FaceModuleNavbar` with authored `fallbackPresets` prefers the host bank and owns selection. Power comes only from `face.power`; no local `bypassed`/`enabled` state. Put `data-module-powered={isFaceModulePowered(face)}` on the root; dim only control groups. Re-skin via `button={{ variant: "switch" }}` or `component={MySkin}`, not a copied switch. ## Host services and dependencies Declare each host service the face uses in `ui.capabilities` (`required`/`optional`) by UI protocol capability name, such as `audio.transcription/1`; `module check` refuses an unknown name and prints their projection. A host lacking a required one shows the generic UI. The UI bundle includes every library the face imports: declare and install it in the module's `package.json` (React and UI kit come with Maru). Keep assets small. ## Shared controls Read props/imports with `read_ui_props` (`maru guide props `). A scaffolded project sees only public exports. Prefer `ParameterKnob`/`ParameterFader` with `source={face}` for numeric controls. Choose by meaning: knobs/faders for continuous values; `FaceParamSelect` or `SegmentedControl` for enums; `ToggleSwitch`/`ConsoleToggle` for booleans; `ConsoleButton` for actions. `maruaudio/ui/portable-controls` also supplies Button, Select and Switch. Reuse their keyboard/focus/popup behavior. Preserve parameter edit gestures. `maruaudio/ui` exports: ActionMenu, AudioClipPlayer, AudioClipSeek, AudioClipTime, AudioClipTransport, AudioClipWaveLayer, AudioClipWaveform, AudioSourcePicker, ChordReadout, CodeEditor, ContextMenuActionsProvider, ContextMenuTarget, DiagnosticOverlay, FaceFileImport, FileDragCard, FileDragGhost, FilterBar, FilterBarSearch, FilterBarSort, FilterBarViewToggle, HostedModuleFace, HostedSchemaFace, ModuleFaceInteractionSurface, MultifxMasterControls, MultifxRack, OutputLevelMeter, ParameterFader, ParameterKnob, ParameterProvider, ParameterSelect, PlosiveRepairResponse, SchemaFace, SoundSourceBrowser, beat-grid-scope, cc-binding-editor, cc-control-chrome, cc-knob-strip, cc-source, chladni-plate, chord-graph, circle-of-fifths, console-button, console-switch, console-tooltip, consonance-matrix, control-label, delay-tap-display, diagnostic-panel, dot-matrix-display, drawbar-strip, drum-lane, dual-band-selector, dynamics-display, envelope-display, envelope-editor, eq-display, eq-editor, eurorack, fader, fader-headless, fixed-velocity-control, fm-algorithm-diagram, fm-routing-matrix, gain-reduction-meter, game-engine-view, glow-button, goniometer, harmony-lattice, info-tip, interval-vector-chart, knob, knob-headless, level-meter, lfo-visualizer, lissajous-scope, macro-knobs, microphone-arrangement-selector, microphone-pattern-selector, midi-activity-table, midi-monitor, module-navbar, module-power-button, multi-voice-piano-roll, note-range-selector, number-field, oscilloscope, pad-grid, panel-tabs, pc-histogram, piano-keyboard, piano-roll, pitch-class-clock, pitch-class-histogram, plan-pad, preset-browser, preset-selector, producer-eq-panel, radial-pad-surface, range-slider, rate-level-envelope-display, resize-handle, rhythm-step-grid, rhythm-wheel, ring, sample-view, sampler-keyboard, scale-picker, scale-remap-control, seed-slots, segment-display, segmented-control, spectrogram, spectrum, staff-notation, status-chip, step-division-selector, step-grid, step-lane, stereo-field, tag-browser, take-switcher, timeline-roll, toggle-headless, toggle-lane, toggle-switch, transfer-curve, transport-controls, transposition-controls, triangle-pad, value-readout, vocoder-panel, waveform-selector, weight-bars, xy-pad, xy-pad-headless. ## Cohesive styling Inspect a rendered PluginUI reference and its TSX/CSS; reuse its visual grammar and shared parts, bound to host values. `themeStyle`/`PRESET_THEMES` (`maruaudio/ui`) supply root tokens; a palette is not art direction. Choose type, finish and composition; monospace only for values. No explanatory prose on the face. Use Maru Icons (`maru-icons/react`); name icon-only buttons. ## Honest displays Draw actual values or declared visualization. No tempo grid without transport. `LissajousScope` uses parameter-derived `figure`/`points`, not measured audio. Use host diagnostics; no second debug overlay. --- # Plan and build a module face > Establish art direction from a rendered reference, compose shared controls and review aesthetic quality separately from behavior in the module workbench. When to read: Read before creating or redesigning an instrument, effect or MIDI-tool face, with or without a reference image, and before changing its layout or visual design. Guide id: `face-from-reference` (`maru guide read face-from-reference` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Use for instrument, effect and MIDI-tool faces, including combined DSP-and-UI requests. `project-planning` owns the joint brief, starter and I/O. Start with a target image; build and review the React face before deep DSP, then integrate sound. Use `maru dev .`, never another parameter host. ## Establish the design before UI code 1. **Inventory the real work.** Record player tasks, gestures, controls, choices, switches, actions, readouts and states in project Markdown. Map each to a schema path or real host operation; state size/density. At DSP handoff verify units/ranges/defaults, signal/control flow, presets, host capabilities and actual display data. Reconcile this inventory whenever DSP changes. 2. **Select a target image before React.** Start from a supplied image, an existing [PluginUI](https://pluginui.com) capture or a generated concept. For a new open brief, create a visual concept if no image establishes the direction; compare different compositions, not recolors. Keep the control inventory honest. Save the selected image/reference in project notes and name its defining typography, material, focal balance and grouping. Inspect supporting TSX/CSS. The image anchors design; APIs define behavior. A theme name or written brief does not replace this visual checkpoint. 3. **Compose the face.** Sketch the major masses and reading order, not merely boxes around parameter groups. Use scale, placement, whitespace and tonal fields to distinguish performance, shaping, modulation and output. Add a divider only when it clarifies a relationship. Empty plots, equal knob grids and micro all-caps headings are not defaults. Map each region to an existing component and supported skin/renderer, with its actual data, range, units and behavior. Read `ui-kit-faces` and query `maru guide props `; verify the generated project's public imports. 4. **Keep words useful.** Short names, values and essential status belong on the panel; explanations belong in help/docs. Give identity, labels and readouts deliberate type roles. Default to sans labels; reserve monospace for suitable values/code. Expressive identity type is welcome. When delegation is authorized, supply tasks, contract, sizes, references and states. Include DSP details only when they constrain the face. Explorers need notes → fingerings and keys → notes. Separate requested velocity, source predictions and measured acoustics. Only explicit groups establish multiphonics. State source coverage; test that target removal, held chords and return to manual input keep edits aimed at visible notes. ## Implement with shared behavior Use the existing module or `maru init` starter; `--face-first` suits a local UI study. The provisional schema owns paths, units, taper, ranges and defaults. Bind through the kit's parameter controls or `faceParamBinding`; use `FaceModuleNavbar` for presets and power. Reuse an assembly's visual grammar and parts, replacing its demo state with host values. Use buttons/actions, selectors/enums, switches/booleans, knobs/faders/values. Verify chosen control APIs for keyboard, exact entry, gestures and popups. Keep captions/readouts shared; `renderDesign` draws artwork. Extend missing behavior at its owner instead of CSS swapping or duplicate proxy controls. Scope styles to the face. Choose deliberate min/default/max sizes and preserve composition in extra space. Review actual captures and interactions using host preview values first. Then wire DSP to the same face, reconcile the contract and rerun both UX and sound checks. Starter sound/state-only controls are intermediate work; record that in notes. Never invent telemetry. ## Review independently **Sound:** use actual engine renders/measurement; report listening separately. **Behavior:** test real host round trips, drag/reset, exact entry commit/cancel, Tab order, preset popup selection/Escape/focus return, modified state and power. Check mapping assign/edit/remove when offered. Exercise touch targets and popup bounds at minimum size; hidden captions must not add tab stops. Run applicable `build-preview-export` checks. Capture min/default/max with the workbench or `maru module screenshot .`. Report gaps; rendering proves no sound/native support. **Design:** view actual captures beside the reference. Compare silhouette, focal balance, typography, material/color and control hierarchy. State what character survived and what was lost. Grouping, component reuse, no overflow and functional tests are usability requirements, not evidence of aesthetic quality. Reject a generic result even when those checks pass. Do not use an agent's aggregate numeric score to certify taste; user rejection supersedes it. Show the actual face beside the concept and record weaknesses. Revisit the composition when it lacks intent; adding separators will not supply it. --- # Presets and state > Hosted project presets, package factory presets, and the saveState/restoreState pair for authored state. When to read: Read before listing, creating, renaming or changing a preset, or before persisting non-parameter state. Guide id: `presets-and-state` (`maru guide read presets-and-state` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Two different things are called "presets", and authored state is a third. Keep them apart. ## 1. Project presets: the hosted lane A project preset belongs to the attached Studio project's module: a name, optional description, visibility, a `params` object and an encoded-state mirror. - `list_project_presets` (`maru preset list`): read existing ids and values **before** an edit. - `insert_project_preset` (`maru preset insert`): a new snapshot. - `edit_project_preset` (`maru preset edit`): change an existing id. - `show_project_preset` (`maru preset show`): a clickable Apply-and-open card. On the CLI these need `maru login`. **Never simulate a preset change by editing module source.** Provide `params` as a JSON object keyed by the module's parameter paths. When `encodedState` is omitted, the same `params` object is stored as JSON; supply `encodedState` only to preserve a known canonical representation. Visibility defaults to private. Preset tools reach only the attached project and owner. ## 2. Factory presets: authored in the package A module declares its factory bank on the declaration: ```ts presets?: readonly AudioModulePreset[] // { id, name, values, tags?, macros? } ``` `values` is keyed by schema parameter paths. The usual layout is `src/presets/index.ts` exporting a typed array, mapped onto the declaration: ```ts import { FACTORY_PRESETS } from "./presets" presets: FACTORY_PRESETS.map((preset) => ({ id: preset.id, name: preset.name, values: preset.params, })), ``` `definePresetLibrary({ tags, presets })` (from `maruaudio/audio/define`) checks at compile time that every preset's `tags` come from the module's own tag list; spread its result into the declaration. `SHARED_PRESET_TAGS` and `pickPresetTags` give the shared musical-role tags. A face receives the host-owned bank through `factoryPresets` and selects one atomically through `onFactoryPresetSelect` (or `FaceModuleNavbar`); it never applies a preset by writing each parameter itself. ### Macro knobs: one-knob presets A factory preset can define up to eight knobs that each move several parameters (`AudioModulePreset.macros`): `macros[0]` drives the schema param `macro.1`. Each knob is `{ label, targets: [{ path, min, max, curve? }] }` with at most 32 targets in total; `min` is the target's value at knob 0 and `max` at knob 1, in the parameter's own units; `curve` is `linear` (default), `exp`, `log` or `s-curve`. Targets must be continuous float parameters. To support them, append `moduleMacroParams()` after the schema's own parameters (from `maruaudio/audio/module-macros`) and add `moduleMacrosResourceSlot()` (from `maruaudio/audio/define`) to `implementation.resources`. In the Processor, accept the `macros` slot in `loadResource` and apply its rows on each `macro.N` write with the helpers in `maruaudio/dsp/control/param-macros` (`paramMacroTableRows`, `paramMacroRowMacro`, `paramMacroTarget`, `paramMacroRowValue`). Set each target's preset value to its `min`. A face shows the knobs with `MacroKnobs` from `maruaudio/ui`. Render each knob at 0 and 1 and check the measured change before calling it done. ### Level an effect's presets Where the `maru` CLI is installed, `maru module eval --suite levels` renders the defaults and every factory preset through the Processor at several input loudness levels and prints output minus input (LU) at the nominal level, the range, a transfer slope (1 follows the input, below 1 compresses) and true peak. Run it after changing a gain law, drive, mix or preset level. Narrow the loop with `--sweep `, `--no-presets`, `--input-lufs -18` and `--max-seconds`; add `--tolerance ` to make it fail. Fix a systematic offset in the gain law, not by writing per-preset output trims, and report the measured numbers rather than "levels matched". ## 3. Authored state: neither of the above A Processor whose durable content is not a parameter and not a host-loaded resource (a step sequencer's patterns, for example) declares `state: { version, maxBytes }` and implements `saveState(state, out) => number` and `restoreState(state, bytes, length) => boolean`. - Declared **together** or not at all. - `saveState` writes at most `state.maxBytes` into the host's `Uint8Array` and returns the byte count; a negative return refuses. Both entries allocate nothing. - Write your own version byte first and write the layout explicitly, so a buffer you do not recognize is refused rather than misread. Returning `false` from `restoreState` is supported: the host keeps defaults. - Declared `state.migrations` run on the host **before** `restoreState`, so it always sees the current version. Parameters are restored separately, before it. Anything a user would automate, map to a knob or record from a DAW is a parameter, not authored state. --- # Assets and prepared resources > Prepared resource slots: declaring them, loadResource for copied and in-place slots, and why resources are not state. When to read: Read when a module needs samples, tables or any host-loaded content. Guide id: `assets-and-resources` (`maru guide read assets-and-resources` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt A Processor allocates nothing in `process`, so it cannot load a sample, a table or a bank by itself. Content reaches it through **prepared resource slots**: the host decodes and uploads, the Processor installs it. ## Declaring slots On the `implementation` object: ```ts implementation: { kind: "processor", source: "src/dsp/processor.ts", resources: [ { id: "sampleArena", kind: "sample", elementType: "f32", maxElements: 1_500_000, loading: "preload" }, { id: "zoneTable", kind: "data", elementType: "f32", maxElements: 4_096, loading: "preload" }, ], } ``` - `id` is a stable name; the **ordinal** binds a load to a slot, so the order is the contract and is **append-only** for a shipped module. At most 16 slots. - `kind` is `"sample"`, `"wavetable"`, `"impulse"`, `"model"` or `"data"`. - `maxElements` is the capacity. A host cannot grow a slot by loading more. - `elementType` is `"f32"` for any module that must build for compiled targets. - `loading` is `"preload"` or `"on-demand"`. - `storage: "in-place"` (optional) makes the slot's storage the content itself instead of a copy; use it for large sample arenas. - `binding` (optional) lets the host fill the slot from content the module declares, chosen by a parameter, instead of from the activating host. ## Receiving them ```ts loadResource(state, slot: number, bytes: Float32Array, length: number): boolean ``` - Called **after `prepare`** and again on replacement; never from `process`. - **Copied slot:** copy the first `length` elements into storage sized from `maxElements` in `createState`; refuse a `length` above `maxElements` with `false`. Allocate nothing. - **In-place slot:** keep the view you are handed and read it in `process`; every call rebinds it. A `length` of `0` means nothing is installed yet, so stop playing what was derived from the previous content. A view of a different size invalidates offsets into the old one. Assign the view through the state path (`state.zone.arena = bytes`), not a local alias. - **`reset` preserves installed resources.** Keep resource storage out of whatever `reset` clears. Decoding (WAV/MP3 containers, PCM unpacking, sample-rate choices) stays in the host. A Processor never parses a container. A host refuses a load for a definition without `loadResource` rather than dropping it. ## Resources are not state Prepared resources are host-owned, one-way content and are **not** written by `saveState`. See `presets-and-state` for the split between parameters, resources and authored state. ## Bundled bytes in the package `src/assets/` holds bytes that ship with the module package. A `*.generated.ts` file is build output: change its generator, never the file. --- # MIDI and event modules > Instruments, event-only MIDI modules, handleEvent/handleMidi/emitEvents and the maxEvents capacities. When to read: Read before changing MIDI behavior, note handling or event generation. Guide id: `midi-and-event-modules` (`maru guide read midi-and-event-modules` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt The facade decides which ports a Processor module has. | Shape | Facade | Ports | |---|---|---| | Instrument | `defineInstrument` | MIDI in → audio out | | MIDI effect | `defineMidiModule` | MIDI in → MIDI out, **no audio** | | Audio effect | `defineEffect` | audio in → audio out | | Generator | `defineGenerator` | audio out, no audio or MIDI in | `defineEffect` and `defineInstrument` add a MIDI output port with `midiOutput: true`. ## Capacities - `maxEvents`: note/CC ingress per block. Required with a MIDI **input** port. - `maxEventOutputs`: egress capacity per block. Required with a MIDI **output** port and **rejected without one**. - Both are positive integers at most **256**. - `maxVoices`: polyphony. Rejected without a MIDI input port; omitted means monophonic. A compact event-only module (a humanizer) declares: ```ts implementation: { kind: "processor", source: "src/dsp/processor.ts", maxEvents: 64, maxEventOutputs: 64, } ``` An event-only Processor prepares at `inputChannels: 0` and `outputChannels: 0`. `process` still runs every block to advance time, but `block.output` has length `0` and **must not be written**. ## Ingress: `handleEvent` ```ts handleEvent(state, kind: number, a: number, b: number): boolean ``` `kind` is `PROCESSOR_EVENT_NOTE_ON` (2), `PROCESSOR_EVENT_NOTE_OFF` (3) or the reserved `PROCESSOR_EVENT_CONTROL_CHANGE` (4), from `maruaudio/dsp/processor`. - Note-on: `a` is the note `0..127`, `b` the normalized velocity `0..1`. Note-off: `b` is `0`. Control change: `a` is the controller, `b` the normalized value. - **No frame offset is passed.** The block is split at event frames and `handleEvent` is called at the split point, so events are sample-accurate. - Parameters never arrive here; they come through `setParameter`. - A host refuses note ingress for a definition without `handleEvent`. Optional, opt-in ingress: - `noteIdentity: true` adds `PROCESSOR_EVENT_NOTE_ON_ID` (5), `PROCESSOR_EVENT_NOTE_OFF_ID` (6) and `PROCESSOR_EVENT_NOTE_EXPRESSION` (7): `a` packs `note + noteId * 256`, so two notes of one pitch stay independent. - `midiDialect: "bytes"` adds `handleMidi(state, status, data1, data2)`, the raw MIDI 1 message; return `false` to decline it. `handleEvent` still runs. ## Egress: `emitEvents` ```ts emitEvents(state, out: ProcessorEventOutput): boolean ``` Called after `process` for the block just processed, with `out.count = 0`. Append by writing index `out.count` in `kinds`, `a`, `b` and `frameOffsets` (and `channels` / `outputPorts` when you address them), then incrementing `out.count`. Never write at or beyond `out.capacity`; never resize. `PROCESSOR_EVENT_MIDI_BYTES` (8) emits an exact MIDI 1 message: `a` packs status, data1, data2 in its low bytes, `b` is the length `1..3`. `frameOffsets` is **block-relative**. A module that delays a note past the current block holds it in a pending list keyed by absolute frame and emits it in the block where that frame lands. `maxEventOutputs` bounds what one block emits, not what is in flight. `maru init --kind instrument` writes an input-to-voice graph example in `src/index.ts`; `processor-instrument` supplies the corresponding event-handling example in `src/dsp/processor.ts`. --- # Build, preview and export evidence > Validation, previews, native builds, exports and GitHub CI publication, with their prerequisites and evidence limits. When to read: Read when the user asks to validate, build, preview, download, export or publish a module, including GitHub Actions and CI. Guide id: `build-preview-export` (`maru guide read build-preview-export` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Use the local CLI for a folder and hosted operations for an account project. Preview, qualification and publication prove different things. ## Local projects Install dependencies, start the generated `dev` script with `--silent`, retain it and return its ready URL early. Bundled JS preview needs no account or native toolkit. Observe both face and DSP edits activating; a build is not hot reload. `validate_module` checks declaration, imports and Graph factories, not types, compilation or sound. Hosted source operations do not upload local files. | Command | Evidence | |---|---| | `npx --no-install maruaudio module check . --fast` | packaging without browser/compiler | | `npx --no-install maruaudio module check . --portability` | Processor compiled-target checks; unavailable compiler is no support | | `npx --no-install maruaudio module eval` | Graph peak/RMS; `--suite levels` compares output/input loudness | | `npx --no-install maruaudio module pack . --out dist`, then `npx --no-install maruaudio render ./dist/web/module --audio in.wav --out out.wav --offline` | actual Processor Program at 48 kHz | | `npx --no-install maruaudio module screenshot` | built face; blank, clipped, unready or wrong Release refuses | | `npx --no-install maruaudio plugin build --format ` | one native build/report | | `npx --no-install maruaudio module verify` | built formats' freshness/validation | | `npx --no-install maruaudio publish --dry-run`, then `npx --no-install maruaudio publish` | upload plan, then publication | Every build writes the module's own UI bundle (`ui/`), its declared libraries included; pack and publish need no FaceShell or flag. A host lacking a capability in `ui.capabilities.required` shows the generic UI. Full check renders `src/qualification.ts`: planar 48 kHz input, one lane per input channel, `(warmupQuanta + measuredQuanta) × 128` frames per lane. `validation.status: unavailable` is no native host validation. ## Local publication and CI `npx --no-install maruaudio publish` detects modules or banks. Inspect help for `--qualify`, `--programs`, `--screenshot`, `--no-screenshot` and `--attach-to-revision-id`. A signed-in dry run resolves the final address; a signed-out dry run only lists the build. Upload needs verified account authority (`modules:publish`); reuse valid sign-in. Source is archived unless `--no-source`, private unless `--source-visibility public` with a source licence. Never invent, ask for or edit a module ID. Report the server's final `@handle/slug` and page URL. The first release captures its face as a cover by default; `--no-screenshot` opts out. Review audience, source visibility and licence. Retain receipts; verify the returned page and Release; a dry run is not sharing. [CI](https://maru.audio/docs/build-and-publish-in-ci) needs pinned matching tools and reports; npm alone is insufficient. Never build untrusted PR code with a publishing token. Publish once outside native matrices; repeated uploads do not aggregate archives. Do not assume hosted native intake exists. ## Hosted projects Check Maru allowance/cost before inference or hosted builds. 1. Select an owned project/template and read its head. Set `visibility: private` for unpublished work; omission defaults public. 2. `npx --no-install maruaudio project source-apply` guards that revision and preserves omitted files. Retain its retry key; recover receipts with `npx --no-install maruaudio project source-change`. 3. `npx --no-install maruaudio project preview` takes the saved revision. Open its browser link; `preview-status` distinguishes requested from last-working revision. Waiting needs an open browser; failed edits can leave the previous version playing. 4. `npx --no-install maruaudio browser-build capabilities` checks admission for that revision. `create` pins source/recipe/toolchain; retain request key/job ID. Reconnect with `status`/`list`, or eligible `retry`/`cancel`. Qualification runs on the worker; admission alone proves no worker ran. 5. `npx --no-install maruaudio module-export capabilities` checks native targets/allowance. Retain `create` ID/key; follow `status`, eligible `cancel`/`retry`, then `download`. Archives are private, expiring development builds. 6. `npx --no-install maruaudio module-publication readiness` checks retained qualified Release, scan, index and browser evidence. Source/preview alone still needs qualification. `publish` pins revision/package/expected publication version for public or unlisted browser release. Native signing/install qualification is separate. Report refusal reasons and requested versus working revisions; queued does not mean executed. ## Sound evidence Agents stay silent. Rendered measurements, human listening, browser behavior and native/DAW qualification are separate; controls and queue states do not approve sound. --- # Build for a device > Choose an existing firmware source project, a portable Processor or a controller app; inspect exact hardware targets, rehearse locally and publish firmware metadata separately from installation. When to read: Read before building for a device, forking firmware, mapping buttons or encoders, creating a MIDI-controller app, or publishing a firmware listing. Guide id: `firmware-and-device-authoring` (`maru guide read firmware-and-device-authoring` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Use the exact device model/revision, intended product, source and licence. Computer-hosted controller apps, device apps and replacement firmware have different runtimes and installation needs. The hardware page's Build entry gives starting points; catalog presence or a shared chip proves no target support. ## Choose the source path | Goal | Start with | Keep portable | | --- | --- | --- | | Change an existing community firmware | Its source repository, pinned commit, build instructions and compatible licence | Preserve provenance, build the unchanged example first and retain its recovery procedure | | Put a Maru instrument, effect or MIDI Processor on hardware | The canonical module and an exact hardware project profile | Parameters, musical events, state and DSP; the target supplies device I/O | | Make a controller app on a computer | `maru init --kind controller-app` and exact controller profiles | Pure named actions/state/frames; the host owns MIDI, scheduling and permission | Read `processor-authoring`, `restricted-typescript` and `midi-and-event-modules` for a Processor. Start audio with `maru init --kind processor-instrument` or `maru init --kind processor-effect`, reusing existing module behavior. A native firmware fork does not become a Maru Processor automatically. For a computer-hosted grid app: ```sh maru init my-grid --kind controller-app --controller-profile novation-launchpad-x cd my-grid npm install maru controller-app check . maru dev . npm test ``` `controller-app.json` owns identity, version and exact adapters. `src/index.ts` exports `CONTROLLER_APP`: pure state/actions/frames shared by the development host and recording-transport fixture. The checker (local MCP: `check_controller_app`) validates data/profile references without executing app source or opening MIDI; physical tests are separate. `maru controller-app bundle .` builds the hashed release bundle; attach it to a GitHub release, set `release.url`, and `maru publish` declares it. Desktop runs it sandboxed. ## Inspect, plan and rehearse Discover the installed surface before promising a command or target: ```sh maru hardware --help maru hardware targets maru hardware boards my-module maru hardware create my-device --module my-module --board fm1-ac791n --plan ``` Use the returned exact profile/target; `fm1-ac791n` is an example, not a universal format. Plans establish declared I/O fit and starter bindings, not RAM, timing or physical behavior. Remove `--plan` only for intended creation. Discover installed flags to validate, check prerequisites, build and emulate a target stage; never substitute another target after refusal. Local MCP hosts can bind `list_hardware_boards`, `create_hardware_project`, `list_hardware_targets`, `validate_hardware_project` and `list_hardware_history`. Target availability means its producer loaded, not compiler/device qualification. Validation evaluates authored module code without sandboxing it; history is retained evidence, not a fresh measurement. Other verbs may be CLI-only: inspect the installed MCP tools and `maru tools describe`. Local operations need host bindings and stay within the selected workspace. A hosted command grants no local USB or project access. Report missing bindings and prerequisites. Map physical inputs to named module actions. Mock and real targets share one bounded state machine for held buttons, modifiers, modes and note release; the face shows accepted state. Test release order, repeated presses, disconnect/reset and stuck-note recovery. Declare unsupported feedback, displays and storage. ## Evidence and delivery Separate host simulation, CPU emulation and physical evidence. Compare native source and generated code with the same algorithm, presets, numeric policy, voices, events, rate and block sizes. Retain output comparisons, artifact hashes, flash/RAM/stack use and deadline margin. Only device measurements prove on-device performance. Agents stay silent; audio measurements and human listening differ. Publish firmware metadata through the existing listing workflow: ```sh maru init my-firmware --kind firmware --device fm-1 maru publish ./my-firmware --kind firmware --dry-run ``` Init creates a source-release listing, not compiled firmware. Complete source, licence, exact device, build, installation and recovery information. Dry-run requires sign-in and contacts the service. Review before authorized publication; use `maru firmware-status ` and its version for metadata corrections. See the [community firmware guide](https://maru.audio/docs/concepts/community-firmware.md). Module publication and a firmware listing are distinct releases. Native plugin and browser module releases each need their own qualification. Publishing a listing never installs firmware. Installation uses the device's documented procedure and exact package checks, with explicit authorization for the write. --- # Graph authoring > Graph modules: a quick chain of existing SDK nodes with connect/expose, and the node factory catalog. Not the default. When to read: Read only when editing an existing Graph module, or when the user asks for a simple chain of existing nodes. Guide id: `graph-authoring` (`maru guide read graph-authoring` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt A Graph module declares no DSP source: it wires existing SDK node factories into a chain. It is the fastest way to build a simple chain of nodes that already exist. It is not the default: anything that needs its own algorithm, custom event handling, prepared resources or authored state is a Processor (`processor-authoring`). ## Shape The facade takes the declaration and a builder callback. This is `src/index.ts` of `maru init --kind effect`: ```ts import { defineEffect } from "maruaudio/audio/define" import { nodes } from "maruaudio/audio/graph" export const AUDIO_MODULE = defineEffect({ id: "__MODULE_ID__", name: "__MODULE_NAME__", schema: { params: [ { path: "tone", label: "Tone", group: "Main", type: "float", min: 80, max: 12000, default: 2400, units: "Hz" }, { path: "level", label: "Level", group: "Main", type: "float", min: 0, max: 1, default: 0.8 }, ] }, ui: { entry: "./ui/index.tsx", minSize: { width: 320, height: 360 }, defaultSize: { width: 720, height: 520 }, maxSize: { width: 1200, height: 900 }, }, }, ({ input, output, connect, expose }) => { const filter = nodes.biquad("filter", { type: 0, frequency: 2400, q: 0.7, gainDb: 0 }) const gain = nodes.gain("gain", { gain: 0.8 }) connect(input.output, filter.audioInput) connect(filter.audioOutput, gain.audioInput) connect(gain.audioOutput, output.input) expose("tone", filter.params.frequency) expose("level", gain.params.gain) }) ``` `maru init --kind instrument` is the instrument equivalent. ## The builder callback - `nodes.(id, params)` creates a node; the `id` is stable. - `connect(from, to)` joins an output port to an input port: `audioInput`, `audioOutput` on nodes, `input.output` and `output.input` at the boundary. - `expose(path, node.params.x, options?)` binds a schema path to a node parameter. Every user-facing control needs one. `options.transform` converts units, e.g. `{ kind: "affine", scale: 1000, offset: 0 }` for seconds onto a millisecond parameter. ## Node factories Exactly what `nodes` offers. **A factory not on this list does not exist.** `adsr`, `autoPanner`, `biquad`, `bitcrusher`, `boundedDelay`, `chebyshev`, `chorus`, `compressor`, `constant`, `controlGain`, `convolution`, `distortion`, `drive`, `dynamicsCompressor`, `envelopeFollower`, `eq3`, `feedbackDelay`, `formantOscillator`, `fractionalDelay`, `frequencyShifter`, `gain`, `gainDb`, `gate`, `lfo`, `lissajousDuo`, `lookaheadLimiter`, `mix`, `modalResonator`, `modalResonatorBank`, `noise`, `oscillator`, `oversampledWaveshaper`, `pan`, `parametricEq3`, `phaser`, `pingPongDelay`, `pitchDetector`, `pitchShifter`, `quantizer`, `reverb`, `sampleTableReader`, `saturatedFeedbackDelay`, `stateVariableFilter`, `stereoGain`, `stereoMix`, `stereoToMono`, `stereoWidth`, `toneFilter`, `tremolo`, `variableShapeOscillator`, `vibrato`, `zOscillator`. Read a node's parameters and ports with `maru dsp nodes` (operation `list_dsp_nodes`) before wiring it. ## Moving to a Processor When the chain needs a node that does not exist, write a Processor. The schema and the face stay; `implementation` becomes `{ kind: "processor", source: "src/dsp/processor.ts" }`, the builder callback goes, and each `expose` becomes a `setParameter` case on the same path. --- # Maru Studio platform > What Maru Studio can create and how projects, revisions, previews, presets and exports relate. When to read: Read when the user asks how Studio works, what can be created, or how project lifecycle pieces fit together. Guide id: `platform-overview` (`maru guide read platform-overview` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Studio is a workspace for creating and managing audio modules, sounds, samples, sample banks and their presets. The assistant's job is that creation work; platform explanations should directly support it. An attached project gives the assistant a private, owner-scoped working context. Source edits create revisions. Valid module revisions are packaged and can produce a browser preview; native exports are separate, longer jobs and are never claimed unless a tool reports completion. Presets are named parameter snapshots scoped to the attached project's module. Project tools cannot reach another user's project, preset or source. The lifecycle metadata in the prompt describes current state; it is not a separate assistant mode. ## One module, many targets A module is authored once: its schema, its face and its Processor (or Graph). That one source is what reaches the browser preview, the hosted runtime and the native VST3 / CLAP / AU / standalone builds. There is no separate "web version" to maintain, which is why the Processor rules are strict: the same source must render the same everywhere. ## What a project contains | Surface | Where | |---|---| | declaration | `src/index.ts`, the sole entry, exporting `AUDIO_MODULE` | | parameter schema | `src/contract.ts` or `src/contract/` | | DSP | `src/dsp/processor.ts` | | face | `src/ui/index.tsx` | | factory presets | `src/presets/` | | bundled bytes | `src/assets/` | ## Entities other than modules A conversation may be attached to a MIDI **sound bank** (clips), a **sampler** (samples and mapping) or a **rack** (connected modules) instead of a module project. Each exposes a different tool set, and the attached scope's own description lists exactly which. Do not force a sample, bank, rack or sampler request into module authoring; `sample-kits-and-banks` covers that content. ## Where authoring knowledge lives `read_guide` (`maru guide read `; `maru guide list` for the catalog) serves focused cards: `project-planning`, `processor-authoring`, `instrument-sound-design`, `restricted-typescript`, `dsp-leaf-catalog`, `parameters-and-schema`, `ui-kit-faces`, `face-from-reference`, `presets-and-state`, `assets-and-resources`, `midi-and-event-modules`, `build-preview-export`, `firmware-and-device-authoring`, `graph-authoring`, `platform-overview`, `porting-web-audio`, `cli-and-operations`, `sample-kits-and-banks`, `generation-and-transcription`, `repository-listing`, `publish-external-plugin`. Load the ones whose triggers match before giving detailed instructions; card text is authoritative over the catalog's one-line summaries. Outside Studio, the same operations run as `maru` commands; see `cli-and-operations`. --- # Porting a Web Audio prototype > Turning a browser Web Audio prototype into a shipping Processor without resynthesis. When to read: Read when the source material is a Web Audio graph or a browser prototype. Guide id: `porting-web-audio` (`maru guide read porting-web-audio` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt A browser Web Audio graph is a **porting source, never a shipping path**. A prototype that builds `OscillatorNode`, `GainNode`, `BiquadFilterNode`, `ConvolverNode`, `WaveShaperNode`, `DelayNode` or `AudioBufferSourceNode` and lets the browser produce the samples describes the product; the module ships as a Processor. ## Start from the existing app or a template For an existing app, inventory its audio, controls, assets and dependencies before choosing what to port. For a new app, choose a matching Maru template. Both use the same saved-project loop: save an exact source revision, open its browser preview, then inspect native-export and publication readiness. See `build-preview-export` for the commands and allowance checks. A preview preserves a fast feedback loop; it does not turn browser APIs or arbitrary npm code into native DSP. Keep the app's compatible interface and move the audio algorithm into Maru's declared Processor contract. If a required leaf or target is unavailable, name the gap before promising a plugin format. ## The rules **No resynthesis.** The prototype is the authority: port its effects as real DSP with the same structure and the same formulas; only the engine changes. A phaser stays that phaser. Porting is not permission to redesign the sound. **No browser node stands in for a missing primitive.** If the port needs an algorithm no `maruaudio/dsp` leaf provides, name the missing leaf; do not keep the Web Audio node or hand-roll an unverified replacement. ## The three steps **1. Inventory the graph.** List every node construction and every `AudioParam` automation call, with what each does musically. Whatever already computes samples in plain JavaScript (tables, geometry, seeded noise, window curves) **moves unchanged** into the Processor. Only the part that ran inside the browser engine needs a leaf. **2. Map each engine node to a leaf.** Check `dsp-leaf-catalog` for what resolves before writing an import. - `BiquadFilterNode` → `maruaudio/dsp/filters/biquad`, which uses the same coefficient formulas but clamps its inputs more tightly and computes in single precision. Compare rather than assume equality. - `DelayNode`, `WaveShaperNode`, `StereoPannerNode` → leaves under `delays/`, `distortion/`, `stereo/` and `mixing/`. They are not spec-exact copies of the browser nodes; assert the difference. - `decodeAudioData` → **nothing.** Decoding is host-side; the Processor receives decoded `f32` through a prepared resource slot (`assets-and-resources`). - Sample-accurate `AudioParam` automation → explicit per-sample ramps in the Processor, counted in samples. **3. Port, then compare.** Render the same input through both and compare. The target is the prototype's output within a stated tolerance, not a sound you judge to be better. Declare any difference you cannot remove. ## After the port The Processor obeys the restricted-TypeScript rules (no allocation in `process`, no `**`, the `Math` allowlist, bounded loops), which a browser prototype never had to. Expect to rewrite scheduling and per-sample loops around them; read `restricted-typescript` before starting. The `processor-effect` scaffold supplies `src/dsp/processor.ts` as a target-lifecycle example. It is a starter, not an implementation of the prototype being ported. --- # The `maru` CLI and its operations > The maru command tree: one operation as a CLI command, MCP tool and Studio tool; discovery with --help, tools describe and guide; auth, JSON input and exit codes. When to read: Read before running a maru command, choosing between commands, passing JSON input, or explaining why a command is unavailable. Guide id: `cli-and-operations` (`maru guide read cli-and-operations` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Use `npx --no-install maruaudio` inside an installed project; before one exists, use `npx maruaudio`. Skills guide the local CLI loop; MCP adds documentation and account access. Operations keep the same snake_case identity across CLI and MCP. ## Discover before you run ```sh npx --no-install maruaudio --help # lifecycle commands and operation groups npx --no-install maruaudio module --help # the verbs in one group npx --no-install maruaudio tools list # every operation and its command npx --no-install maruaudio tools describe validate_module # the JSON Schema of one input npx --no-install maruaudio guide list # choose matching guide cards ``` Flags are derived from each operation's schema, so read `--help` or `npx --no-install maruaudio tools describe` rather than guessing one. Every operation also accepts `--input ''`, with flags overriding its fields; arrays and objects are JSON. `npx --no-install maruaudio tools call --input ''` runs any operation by name. Global `--json` prints the structured result on stdout and errors as JSON on stderr. ## Lifecycle and creation Discover lifecycle commands and operation groups through installed help. `doctor` checks this machine; `module doctor` checks its module toolchain. `npx maruaudio init [dir] --kind ` creates a module project from a bundled template. Prefer `processor-effect` or `processor-instrument` for authored DSP; `effect` and `instrument` wire existing Graph nodes. Over the local MCP server the same operation is `init` (`maru_init`), with the same options as fields (`dir`, `kind`, `from`, `install`, ...), unattended and limited to the workspace root: it is an agent's first step for a new module. `scaffold_module` is only for roster entries inside the Maru source checkout. `module pack` (`module_pack`) writes a module's web Release into a local folder and uploads nothing; `publish` (`maru publish`, `maru_publish`) uploads and activates it on the signed-in profile. `npx maruaudio init [dir] --from ` starts a local project from a module whose source may be remixed, with no online project: a blank starter offline (`blank-effect`, `blank-instrument`, `blank-graph-effect`, `blank-graph-instrument`, `blank-face-first --params a,b`), a catalog module (`osc-mini`) or a community module (`@handle/`, or its link). A bare slug is exactly `@maru/`, for `resolve`, `install` and `remix` too. A path (`./x`) is refused. Every new project or copy receives a generated permanent identity; `.maru/source.json` records the origin. Never choose or edit an ID. Refusals exit `5` or `6`. An official bank (`grand-piano`) starts a Maru Sampler project that references it. Outside a checkout, `npx --no-install maruaudio module list` shows the official catalog and `npx --no-install maruaudio module examples` the starters. ## Exit codes | Code | Meaning | |---|---| | `0` | ok | | `1` | the operation ran and failed | | `2` | bad command line or input; nothing ran | | `3` | not signed in, or credentials rejected | | `4` | a prerequisite is missing: toolchain, payload, extension or binding | | `5` | the item's licence forbids it (a remix of a module its creator reserved) | | `6` | a paid item this account does not own; buy it, then retry | A listed command is not proof this install can run it. Operations marked `[auth]` in `npx --no-install maruaudio tools list` need a valid sign-in; the account, not an input field, decides whose project is touched. `[toolchain:native]` needs the native toolchain. Report a refusal or exit `4` exactly; never substitute a different command or invent one. Before an account operation, use `npx --no-install maruaudio whoami --json` to verify the selected account, issuer, profile, token expiry and required grants. Reuse suitable existing authorization. Hosted MCP access alone does not establish CLI access, and identity alone does not establish `modules:publish` for local uploads. An authorized personal key can use `npx --no-install maruaudio login --with-token --json` through private process stdin instead of another browser sign-in; preserve other profiles and follow the setup's intended account and permissions. Verified login metadata can supply the identity check; an offline/unverified save is insufficient. Never extract connector OAuth caches or put keys in command arguments, project files or diagnostics. Local JS creation and preview need no account; only start browser sign-in when the intended account operation needs it. Writes and destructive operations ask for confirmation in a terminal. Pass `-y` only when the user has agreed to that action. ## MCP `npx --no-install maruaudio mcp` serves the same operations over stdio, with JSON Schemas, annotations, progress and cancellation. The workspace is the client's first file root, else the launch directory. Tool names carry a brand prefix: copy the exact name the server lists. A hosted profile exposes fewer tools. Use the local MCP's unverified CLI context to recover `--profile`; verify it with `whoami`. A named profile does not change plain CLI defaults. ## Installing things Install `maruaudio` for the CLI and the `maruaudio/*` imports. Before telling a user to install any other package, confirm it is published (`npm view `); a name in source code is not evidence of a release. --- # Sample kits, banks and delivered content > Choosing between a generated drum kit, a generated pitched instrument, a hosted MIDI bank and a Sampler module, and what proves a bank playable. When to read: Read before building, generating, packaging or describing a sample kit, a sampler bank or a sound bank. Guide id: `sample-kits-and-banks` (`maru guide read sample-kits-and-banks` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Choose by what the user wants to end up with. | Outcome | Route | Evidence to report | |---|---|---| | Drum kit from a prompt | `maru audio generate kit ""` (`generate_kit`), signed in | the kit id, the seed, the 16 pad roles and their URLs, and the job id while it is still rendering | | Hosted MIDI clip bank | `maru midi-bank create ""` (`create_sound_bank`), signed in | the bank id and the MIDI clips it actually holds | | A saved sampler bank, published for others | `maru bank publish <folder\|slug>` or `maru publish` in its folder (`bank_publish`), signed in | the printed `@handle/slug@version` reference and page; `--dry-run` first | | A sample pack of many generated sounds | `maru audio pack-plan`, then `maru sample-pack admit` (`prepare_sample_pack`, `pack_admit`), signed in with `inference:run` | the receipt's quote, `onQueue` and `remaining`, and each finished `clipId`; never say queued before a receipt says so | | A sample pack, published for others | `maru sample-pack set-members`, then `maru publish <id or slug> --kind pack`, signed in | the printed `@handle/slug` reference and page; `--dry-run` first, for each member's eligibility | | Sampler instrument in a module | a Processor with prepared resource slots (`assets-and-resources`) | sample bytes, note/velocity mapping, loops, saved-state recall | In Studio chat, `studio_generate_audio` creates user-owned sounds or a Sampler project, and `studio_generate_midi` writes MIDI clips only; neither publishes anything. `create_sound_bank` creates an **empty** MIDI bank. It does not generate audio, and an empty bank or a list of samples is not a playable kit. Play samples through the Sampler; never write a second player in a page or a pack script. `bank_publish` freezes the bank's **saved** revision on the server. Run from a bank folder (`maru remix @x/bank --dir ./b` writes one, samples included), it first pushes the folder's edits: new or changed samples upload, and `bank.json` / `instrument.json` save as the next revision, which is the one published (`--dry-run` lists the uploads). `maru bank withdraw` takes a publication offline again. Hosted instrument generation (`generate_instrument`) is not served yet; build a pitched instrument from generated one-shots in the Sampler instead. A pack is prepared like any generated thing, only bigger. `pack_admit` quotes the brief against its credit ceiling and refuses a plan over it, then queues at most 32 candidates per call, within the account's job and usage limits. Run the same brief again to continue; nothing is charged twice. Its dry run reports each finished `clipId`. Choose and order them with `pack_set_members`: `expected` is what `pack_preview` last returned, and a stale one is refused. Publishing needs a cover, an address and at least four different sounds, and every member through publication; a `blocked` answer gives each reason. Admitting generates no cover and publishes nothing. ## Checking a kit Listen before you name it. A generated kit proves sixteen regions exist, not that each pad is the sound its role names. Check every delivered sample for clipping, DC offset, silence and clean start and end; keep the raw and the delivered versions apart, and report any pad you rejected and why. ## Pitched banks Inspect every take. Author note, velocity, root and loop metadata yourself and test the mapping in the Sampler; an analyzer label does not prove a steady root or a clean loop. Keep variants and the reason each take was rejected. ## What proves a bank works Load the exact delivered bank in the Sampler and test mapping, samples, presets and saved-state recall. An archive that wrote successfully proves none of these, and neither does a bank that only loads. Samples and presets keep a stable identity across versions; see `assets-and-resources` for how a Processor receives them, and `generation-and-transcription` for the hosted generation jobs. --- # Audio generation, MIDI and analysis > Hosted audio generation and audio-to-MIDI transcription: the maru audio commands, Studio tools, their limits, and what counts as a finished job. When to read: Read before generating audio, transcribing audio to MIDI, or promising that either is available. Guide id: `generation-and-transcription` (`maru guide read generation-and-transcription` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt Finite generation and audio processing run outside realtime code: never in `process`, a face or a resource load. Stay inside the user's requested work. Reading this card runs nothing. ## Choose the intended result - `submit_audio_job` (`maru audio submit --submission '<JSON>'`) creates private raw artifacts. Its canonical submission includes schema `maru-audio-job/v1`, a retained `requestKey`, `task` and `persistence: { mode: "artifact_only" }`. - `generate_sample` (`maru audio sample --task '<JSON>' --request-key <key>`) renders exactly one explicit seed, requires monophonic MIDI and standard analysis, then saves one private account sample. It preflights all required children before rendering. Follow `get_audio_workflow` / `audio workflow`; retry only a failed step with a new retry key. Completed audio is retained. - `generate_audio`, `generate_kit`, `check_audio_generation` and `cancel_audio_generation` keep their account-saving take semantics (CLI `audio generate`, `audio generate kit`, `audio status`, `audio cancel`). - Studio chat keeps `studio_generate_audio` for owned sounds/Sampler projects and `studio_generate_midi` for MIDI clips. Neither publishes anything. Inspect `list_audio_capabilities` / `maru audio capabilities` before offering an action. Availability needs a compatible live worker; source code alone does not establish deployment. Speech has no selected model. Stem separation, polyphonic MIDI and rhythm are distinct worker capabilities, and device and hosted separation are separate boundaries: never substitute one for another. ## Follow and collect a raw job `get_audio_job` reads status and artifact descriptors; `list_audio_jobs` pages raw submissions; `get_audio_job_events` replays persisted events after a saved sequence; `get_audio_job_by_request_key` recovers a lost submission response. The same request key recovers the original job and usage receipt; changed input under it is refused. A reroll uses a new key. `get_audio_artifact` returns immutable metadata and an authenticated download path. `maru audio artifact <job-id> <artifact-id> --out ./artifact` saves verified bytes and never overwrites; a local write error loses no remote identity. MCP exposes the same operations with `maru_` prefixes and writes no files on a user's computer. Keep account credentials out of faces and source. `cancel_audio_job` needs inference permission and adds no charge. `retry_audio_job` rechecks source/runtime access and needs its own retained request key. Workflow children are read by `childJobIds` and controlled through workflow cancel and step retry. ## Supply and interpret audio For an owned library sound, `analyze_sample` with its `clipId` and `mode: "rhythm"` (`maru audio analyze-sample <clipId> --mode rhythm`) retains beat-grid JSON/MIDI beside the exact source through the `analyze_sound` workflow; `mode: "stems"` selects stem separation and pitched MIDI and does not classify drum hits. Follow `get_audio_workflow`, then its child jobs and artifacts. `maru audio upload <file>` or the SDK's `audio.sources.upload` uploads and normalizes owned audio; MCP's `prepare_audio_source` normalizes an already finalized owned asset. Sources are immutable asset/artifact identities, never arbitrary URLs or paths; access and retention are rechecked on every use. A completed separation job's stem can be the next job's `kind: "job_artifact"` source: use the returned descriptor, never an invented path. This composes jobs; it is not an automatic separation workflow. Monophonic MIDI and polyphonic MIDI are separate capabilities. No-note detection is a valid result. Pitch summaries, trajectories and MIDI notes are different data, and MIDI container tempo is not measured tempo: compare extracted notes with the original audio before reporting success. For beats and downbeats, submit `task: { type: "analyze_audio", modelId: "beat-this/small0-onnx", analyses: ["rhythm"], source }`: at most 30 seconds, a healthy `cpu:beat-this` worker, analysis JSON and metronome MIDI, including an explicit no-beats result. It does not classify kick/snare/hat events; do not substitute a noncommercial research runner. The same submission works through the CLI, MCP, Studio's job tools and `audioAnalysis.jobs.submit`. For classified drum MIDI, submit `task: { type: "transcribe_audio_to_midi", mode: "drums", modelId: "inverse-drum-machine/idm-44-train-kits", source }` the same way, after checking capabilities for that model. Inspect its `midi_evidence`; empty `no_notes` is valid, and the notes are unquantized candidates to compare with the source, not drum-kit audio. Legacy `transcribe_audio_to_midi` / `audio transcribe` is the monophonic convenience operation. Examples for HTTP, SDK, CLI, MCP and module hosts: [Add generative audio to your app](https://maru.audio/docs/generative-features.md). --- # Listing a plugin built with another framework > Listing a plugin built with another framework from its GitHub repository and releases: .maru/listing.json, maru listing init|check|publish|status, ownership, the listings:publish token for CI, Maru Desktop installs, and what building it with Maru adds. When to read: Read when the user has an existing plugin, binaries or releases built with another framework (JUCE, iPlug2 or others) and wants it on Maru, or asks about .maru/listing.json, maru listing, listing a GitHub repository, Desktop installs of external plugins, or a listings:publish token. Guide id: `repository-listing` (`maru guide read repository-listing` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt A plugin built with JUCE, iPlug2, DPF or any other framework is listed on Maru as it is. From its public GitHub repository and releases it takes one file, `.maru/listing.json`, and no Maru build. A repository of release files only works. ## One product, three ways to add a release Each plugin entry is one Maru product: a page at `/plugins/@owner/slug` with its listing, media, offer and releases. Releases come from GitHub releases (this card: **community releases**, "Community release · not reviewed by Maru", the author's files, never built, signed or tested by Maru), an upload Maru hosts after its scan and review, or the maker's own download page. The last two, media and the offer are `maru marketplace` stages (`whoami`, `project`, `draft`, `media`, `release`, `offer`, `submit`, `status`). A listing shows README, screenshots, licence, "Built with JUCE" and declared compatibility; no web preview, racks, verified badge or Maru sale. Never call a community release reviewed or verified. ## The file ```json { "$schema": "https://maru.audio/schema/repository/listing/alpha.json", "format": "maru-listing/v1", "listings": [{ "family": "plugins", "slug": "glass-hall", "name": "Glass Hall", "kind": "effect", "license": "LicenseRef-GlassHall-Freeware", "readme": { "path": "README.md" }, "credits": [{ "github": "your-login", "role": "author" }], "plugin": { "framework": "juce", "formats": ["vst3", "standalone"], "platforms": ["macos"], "compatibility": { "macos": { "minVersion": "11.0", "architectures": ["arm64"], "signing": "unsigned" } }, "hosts": [{ "name": "Ableton Live", "version": "12", "status": "tested" }], "install": { "method": "archive", "notes": "Unzip; move the VST3 to ~/Library/Audio/Plug-Ins/VST3." }, "releaseAssets": [{ "match": "GlassHall-*-macOS-arm64.zip", "platforms": ["macos"], "architectures": ["arm64"], "formats": ["vst3", "standalone"] }] } }], "display": { "readme": true } } ``` - `releaseAssets[].match`: `*` stands for the version, so one pattern names each release's file. `architectures` ⊂ `arm64`, `x64`, `universal`; unset is unknown, not universal. A `.zip` is a bundle archive. - `compatibility.<platform>`: `minVersion`, `architectures`, `signing` (`unsigned`, `signed`, `notarized`), shown as declared by the author. - `install.method`: `archive`, `installer`, `download` or `build-from-source`. - `hosts`: up to 12, `tested`, `reported` or `known-issue`. - `framework`: a credit, never a capability. - `display`: permission to show the README and `media`; defaults to none. ## The commands ```sh maru listing init --family plugins --kind effect # draft; never overwrites # complete the draft by hand maru listing check # every problem Maru would ignore; exits 1 on any # commit .maru/listing.json maru login # or MARU_TOKEN holding a listings:publish token maru listing publish # [--repo owner/name] [--ref v1.0.0] maru listing status # read-only: pages and the last read ``` `publish` sends nothing for an absent or unreadable file (exit 1), takes the repository from `origin`, and prints each page URL and state (`listed`, `hidden`, `withdrawn`, `slug-taken`, `awaiting-claim`, `not-a-plugin`), the releases read and the file's problems (`--json` too). Exit 3: not signed in or no `listings:publish`. Exit 1: Maru refused (ownership; one read per repository a minute, ten per account an hour). MCP: `listing_publish`, `listing_status`. ## Ownership The GitHub account linked at `/account/connections` must own the repository. For an organization's repository, `credits` must name your GitHub login as `owner` or `maintainer`. `/account/owner/me/releases` (*Add a repository*) does the same. ## CI `maru listing init --ci` also writes `.github/workflows/maru-listing.yml`, which runs `maru listing check` and `maru listing publish --ref <tag>` on each published release. Create a token at `/account/tokens` with only `listings:publish`, saved as the `MARU_TOKEN` repository secret; it can do nothing else. No `pull_request` trigger. Tutorial: `/docs/publish-a-listing-from-ci`; reference: `/docs/repository-listing`. ## Maru Desktop Desktop installs only `.zip` bundle archives on a matching Mac, after checking GitHub's SHA-256, and never removes quarantine. Other files get the GitHub download and the author's notes. ## Go further: build it with Maru Offer this once the listing works. Ported to the Maru framework, the plugin gets a web demo on its page, recomposition in racks and other modules, remixing when open source, and automated builds for every DAW format and OS. For unusual technology the Maru team works with the author (`/contact`). Start with `/docs/choosing-maru` and `/docs/constraints-for-plugin-developers`, `maru guide read platform-overview`, then `maru init --kind processor-effect`. --- # Publishing a plugin made with another framework > Publishing a plugin project made with another framework (NIH-plug, DPF, JUCE…) from the terminal: maru publish's three routes, a hosted build (maru build preview|create|status|logs|cancel|allowance), reading its health checks, maru release check|publish, and what to do for each failure code. When to read: Read when asked to publish, build or release a plugin project that is not a Maru module on Maru, or when a build_* or build_release_* result or maru publish/build/release command reports a failure code. Guide id: `publish-external-plugin` (`maru guide read publish-external-plugin` prints the version matching the installed CLI) Guide index: https://maru.audio/guides/llms.txt "Publish this plugin on Maru", for a project that isn't a Maru module (NIH-plug, DPF, JUCE, iPlug2, CMake): everything `/publish` does, from the terminal. Ask the maker before anything that uses build minutes or publishes under their name. ## Choose the route Run `maru publish` in the project folder. It detects the framework with the same detector the web page uses, uploads nothing, and offers `/publish`'s three routes (`--json` gives `status: "needs-route"` and `routes[]`): | Route | When | Command | | --- | --- | --- | | `project`: Maru builds it | NIH-plug or DPF source | `maru publish --route project` | | `releases`: list the releases you build | JUCE (Maru can't build it under JUCE's licence), or any project already built in CI | `maru listing init --family plugins --ci` (`repository-listing` guide) | | `module`: a Maru module | Porting it to the Maru framework | `maru init`, Studio (`platform-overview` guide) | ## Maru builds it ```sh maru publish --route project # upload, detect; stops for the maker to confirm maru publish --route project --recipe nih-plug-xtask/1 --platform linux-x64 [--plugins gain] maru build status <id> --wait-seconds 1800 # progress on stderr; exit 1 if it failed maru build logs <id> # the end of job.log maru release check <id> # the readiness checklist maru release publish <id> --release-version 0.1.0 --notes "First release." ``` Step by step: `maru build preview [path] | --repository owner/name --ref v1`, `maru build create <preview>`, `cancel`, `allowance`, `history`. MCP tools are `build_*` and `build_release_*` by the same names. The hosted connector reads GitHub sources only; a local folder needs the CLI or `maru mcp`. A hosted call waits about 45 s; call `build_status` again. - **Confirm before building.** Show the preview's recipes, platforms and plugins; build only what the maker confirms. One build per platform. - **Read the results honestly.** Per bundle: inspection and health checks, `Passed`, `Warnings`, `Failed`, `Incomplete` or `Not run`. Not run is never a pass. Health checks measure loading, finite audible output and parameter moves; they never judge the sound. Fix a failed check from its hint, recheck with `maru plugin check <bundle>` on a local build, then build again. - `build_status`'s `agentPrompt` is the build page's Copy for your agent. - **Publishing.** Blocking: a profile handle, at least one download, release notes, and the listing service's own blockers. Advisory: licence, passed health checks. Ask the maker for the notes and the version (`suggestedVersion`). Bundles stay unsigned until Maru signs after review. ## Failure codes Every refusal ends with its code in brackets; `--json` errors carry it as `error.code`. Whose move it is decides what to do. | Code | Do this | | --- | --- | | `juce_licence` | Don't retry. Take the `releases` route. | | `no_fixed_recipe`, `unrecognised_project` | Point at the folder holding `Cargo.toml` (NIH-plug) or the DPF `Makefile`/`CMakeLists.txt`; otherwise the `releases` route. | | `unsafe_identifier` | Rename the package or plugin to letters, digits, `-` and `_`. | | `recipe_mismatch`, `unsupported_platform`, `plugin_selection`, `recipe_not_detected`, `platform_not_in_recipe`, `plugin_not_detected`, `plugin_subset_not_supported` | Preview again and choose from what it offers. | | `preview_not_ready` | Wait with `maru build preview-status <id> --wait-seconds 120`. | | `source_unavailable`, `ref_not_found`, `github_unavailable` | Public repository, a real branch, tag or commit, https submodules. | | `source_unreadable` | Replace symlinks leaving the project and special files; upload again. | | `dependency_fetch_failed` | Commit `Cargo.lock`; crates.io or public GitHub dependencies only. | | `build_failed`, `no_bundles` | `maru build logs <id>`, fix the compiler error or bundle settings, build locally, build again. | | `timed_out`, `output_too_large` | Fewer plugins per build; drop large generated files. | | `inspection_rejected` | The log names the bundle and reason; fix it, build again. | | `rate_limited`, `build_minutes_exhausted` | Detections (hourly) or the month's 60 build minutes used; the message says when they reset. Don't loop. | | `runner_error`, `storage_failed`, `archive_storage_unavailable` | Maru's side: nothing to change; build again once. | | `external_builds_closed`, `source_not_admitted` | Maru's side: hosted builds aren't open here; take the `releases` route meanwhile. | | `release_not_ready` | `maru release check <id>`, then supply what blocks. | | `not_found` | Wrong id; `maru build history`. | Exit codes: 3 not signed in or missing `builds:trigger` (`maru login` again), 5 `juce_licence`, 2 invalid input, 4 builds closed here, 1 any other failure. The maker's inbox says when a build or detection ends; an agent still polls.