# Faust Build

> Compile a Faust DSP source file to C, verify the API surface (function names, I/O counts, struct name), and optionally compile the result with clang. Runs a parameter smoothing audit before compilation. Use after any change to a .dsp file.

- **Type:** Skill
- **Install:** `agentstack add skill-gertsylvest-meta-team-faust-build`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [gertsylvest](https://agentstack.voostack.com/s/gertsylvest)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [gertsylvest](https://github.com/gertsylvest)
- **Source:** https://github.com/gertsylvest/meta-team/tree/main/library/skills/faust-build

## Install

```sh
agentstack add skill-gertsylvest-meta-team-faust-build
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Faust Build

Compile a Faust DSP source file to C and verify the result is structurally correct. Combines three steps that were performed manually on every DSP change: parameter audit, compilation, and API surface verification. Optionally adds a clang compile step to catch type errors early.

## Requirements

- **Faust compiler** on `PATH` (or specify binary with `--faust`). Tested against Faust 2.85.x.
  - Known issue: `-ftz 2` generates broken C in Faust 2.85.5. This script defaults to `-ftz 0` (see `--ftz` option).
- **clang** (optional, only needed for `--clang` step)
- **Faust architecture headers** (optional, only needed for `--clang`): the directory containing `faust/gui/CInterface.h`. Pass via `--faust-arch`.

## Instructions

Arguments are in `$ARGUMENTS`. Pass them directly to the build script:

```bash
bash "$(dirname "$0")/build.sh" $ARGUMENTS
```

## Steps performed

| Step | What it does |
|------|--------------|
| **0 — Param audit** | Scans the `.dsp` source for `hslider`/`vslider`/`nentry` parameters not followed by `si.smoo` or `si.smooth` on the same line. Flags as warnings (heuristic; does not catch multi-line smoothing). |
| **1 — Faust compile** | Runs `faust -lang c -cn  -single -ftz   -o  `. Aborts on compiler failure. |
| **2 — API surface check** | Greps the generated C for all 14 expected public function names (suffix = class name). Checks that `FAUSTCLASS` macro matches. Optionally verifies `getNumInputs` and `getNumOutputs` return values. |
| **3 — Clang compile** (optional) | Runs `clang -std=c11 -O2 -Wall -Wextra -include faust/gui/CInterface.h -Wno-unused-parameter -c `. The force-include is required because Faust-generated C references `UIGlue`, `MetaGlue`, and `Soundfile` without including their definitions. |

## Options

| Option | Default | Description |
|--------|---------|-------------|
| `--cn NAME` | `mydsp` | Faust class name (`-cn` flag). All generated function names are suffixed with this. |
| `-I PATH` | — | Include path for Faust library resolution (repeatable). Typically needs `dsp/modules` and the `faustlibraries` path. |
| `--faust BIN` | `faust` | Faust compiler binary path. |
| `--faust-arch DIR` | — | Directory containing `faust/gui/CInterface.h`. Required for `--clang`. |
| `--ftz N` | `0` | Faust denormal flushing mode. Use `0` for Faust 2.85.x (the default); `-ftz 2` is broken in that version. |
| `--clang` | off | Run `clang -c -Wall` on the generated C as a final verification step. |
| `--inputs N` | — | Expected `getNumInputs` return value. Fails if the generated code disagrees. |
| `--outputs N` | — | Expected `getNumOutputs` return value. Fails if the generated code disagrees. |

## Exit codes

- `0` — all checks passed (warnings do not fail the build)
- `1` — Faust compilation failed, or one or more API surface checks failed, or clang failed

## Examples

```bash
# Minimal: compile and verify API surface
bash build.sh src/dsp/synth.dsp src/generated/synth.c --cn Synth

# With library paths and expected I/O counts
bash build.sh src/dsp/synth.dsp src/generated/synth.c \
  --cn Synth \
  -I dsp/modules \
  -I ~/faust/faustlibraries \
  --inputs 0 --outputs 1

# Full verification including clang
bash build.sh src/dsp/synth.dsp src/generated/synth.c \
  --cn Synth \
  -I dsp/modules \
  -I ~/faust/faustlibraries \
  --faust-arch ~/faust/architecture \
  --clang \
  --inputs 0 --outputs 1
```

## Notes

- `-ftz 0` means no Faust-level denormal flushing. Move denormal protection to the driver layer (FTZ/DAZ CPU flags on the audio thread). This is better separation of concerns anyway.
- The param audit checks only within single lines. A parameter smoothed on the next line (e.g. `freq = hslider(...)\n  : si.smoo`) will be flagged as a warning even though it is correctly smoothed. Treat warnings as review prompts, not definitive failures.
- The public API for `-cn Synth` is: `newSynth`, `deleteSynth`, `metadataSynth`, `getSampleRateSynth`, `getNumInputsSynth`, `getNumOutputsSynth`, `classInitSynth`, `instanceResetUserInterfaceSynth`, `instanceClearSynth`, `instanceConstantsSynth`, `instanceInitSynth`, `initSynth`, `buildUserInterfaceSynth`, `computeSynth`. All 14 must be present for a valid build.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [gertsylvest](https://github.com/gertsylvest)
- **Source:** [gertsylvest/meta-team](https://github.com/gertsylvest/meta-team)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-gertsylvest-meta-team-faust-build
- Seller: https://agentstack.voostack.com/s/gertsylvest
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
