Faust

From danielraffel/pulp · View interactive version

Faust is an AI agent skill from the GitHub repository danielraffel/pulp. Create Faust DSP plugins in Pulp using Pulp-owned reference DSPs, optional external code generation, and the FaustProcessor template wrapper.

How to use this skill

Skill file

FAUST DSL

Use this skill when a task involves writing, generating, or testing FAUST-based processors in Pulp.

Truthful Position

Pulp supports a narrow Faust lane built around FaustProcessor<T>, Pulp-owned

reference DSP implementations, and optional external code generation. The

Faust compiler is supplied and licensed by the developer; Pulp does not vendor,

download, redistribute, or require it for normal builds.

Supported now:

source equivalence to their adjacent .dsp examples is claimed

topology and blocks up to the declared maximum size

Not supported by this skill:

Core Files

| File | Purpose |

|------|---------|

| core/dsl/include/pulp/dsl/faust_base.hpp | Pulp-owned Faust compatibility interfaces (dsp, UI, Meta) |

| core/dsl/include/pulp/dsl/faust_processor.hpp | FaustProcessor<T> template and PulpFaustUI |

| core/dsl/include/pulp/dsl/dsl_processor.hpp | DslProcessor base class shared across DSL lanes |

| tools/cmake/PulpFaust.cmake | CMake module: pulp_faust_generate(), pulp_add_faust_test() |

| examples/faust-gain/ | Stereo gain — simplest FAUST example |

| examples/faust-filter/ | Parametric filter example |

| examples/faust-tremolo/ | Tremolo with rate/depth |

How It Works

FaustProcessor<T> accepts a default-constructible class derived from ::dsp.

Pulp provides the narrow compatibility interfaces in faust_base.hpp, which

are used by its reference DSPs and can also adapt a compatible artifact produced

by an externally supplied Faust compiler.

  1. Constructor calls buildUserInterface() to discover parameters and metadata() for plugin info
  2. define_parameters() registers each FAUST zone as a StateStore parameter with correct range/unit/group
  3. prepare() validates the declared input/output channel topology, stores

the maximum block size, pre-sizes the raw channel-pointer arrays, and calls

dsp::init(sample_rate)

  1. process() accepts only that prepared topology and a block no larger

than the declared maximum. It reuses the pre-sized pointer arrays, syncs

StateStore values into FAUST zone pointers, and calls dsp::compute()

without constructing or resizing vectors. An unprepared call, a channel

mismatch, an undersized buffer, or an oversized block fails closed by

clearing the output without calling the FAUST DSP.

Creating a FAUST Plugin

1. Write the .dsp source

// examples/faust-myplugin/myplugin.dsp
declare name "MyPlugin";
declare author "YourName";
declare version "1.0.0";

import("stdfaust.lib");

gain = hslider("Gain [unit:dB]", 0, -60, 24, 0.1) : ba.db2linear;
process = _, _ : *(gain), *(gain);

2. Optionally generate a developer-owned C++ artifact

This requires an externally supplied faust executable. Record or pin the

compiler identity and verify its output before claiming that an artifact

corresponds to a source file.

faust -lang cpp -cn MyPluginDsp -o build/myplugin_faust.hpp \
    examples/faust-myplugin/myplugin.dsp

Or let CMake handle it (regenerates when .dsp changes):

include(PulpFaust)
pulp_faust_generate(
    ${CMAKE_CURRENT_BINARY_DIR}/myplugin_faust.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/myplugin.dsp
    MyPluginDsp
)

The helper is inactive when faust is unavailable. Pulp's checked-in reference

DSPs remain buildable independently of the optional compiler.

3. Write the processor wrapper

// examples/faust-myplugin/faust_myplugin.hpp
#pragma once
#include "myplugin_faust.hpp" // developer-owned, verified external artifact
#include <pulp/dsl/faust_processor.hpp>

namespace pulp::examples {
using MyPluginProcessor = dsl::FaustProcessor<MyPluginDsp>;

inline std::unique_ptr<format::Processor> create_my_plugin() {
    return std::make_unique<MyPluginProcessor>();
}
} // namespace pulp::examples

4. Add CMakeLists.txt

if(PULP_BUILD_TESTS)
    add_executable(pulp-faust-myplugin-test test_faust_myplugin.cpp)
    target_link_libraries(pulp-faust-myplugin-test PRIVATE pulp::dsl pulp::format Catch2::Catch2WithMain)
    target_include_directories(pulp-faust-myplugin-test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
    catch_discover_tests(pulp-faust-myplugin-test)
endif()

5. Write tests

Follow the pattern in examples/faust-gain/test_faust_gain.cpp:

dsp class

Build and Test

# Build the Pulp reference DSP examples (no faust needed)
tools/ci/governed-build.sh cmake --build build

# Run all FAUST tests
ctest --test-dir build -R "faust" --output-on-failure

# Run one example
ctest --test-dir build -R "FaustGain" --output-on-failure

# Generate every registered optional artifact (target exists when faust is found)
cmake --build build --target faust-regenerate

What To Check

When modifying the FAUST lane, verify:

installed

unless a pinned compiler and verification receipt prove a stronger claim

dsp class's buildUserInterface() metadata

runtime blocks are rejected and cleared rather than processed

while unprepared and mismatched shapes fail closed

Boundaries

This skill covers the Pulp reference DSP and optional external Faust codegen

lane only.

reference implementations by default

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.