Start here

What Pole is

A DSP language with a real compiler, a wasm target, and compiled code that needs nothing but the C math library.

Anyone who writes audio code, or wants to.

Pole is a language for writing audio DSP. You write a processor, it compiles, and you hear it — from a command line, in a browser, or inside a plugin your DAW loads.

The block below is a complete program. Press Run.

A sine you can hearPlayground
processor Sine
{
    output stream float out;
    param  float freq = 220.0f [55.0f, 880.0f] smooth 20.0f;

    float phase = 0.0f;

    void main()
    {
        loop
        {
            out <- sin (phase) * 0.2f;
            phase = phase + 6.2831853f * freq / processor.frequency;
            if (phase >= 6.2831853f) { phase = phase - 6.2831853f; }
            advance();
        }
    }
}

The shape of every program#

Three ideas carry most of the language.

A processor declares its endpoints. input and output are the wires in and out. param is an input that also carries a name, a default and a range, so a host can enumerate a patch's controls rather than being told the layout out of band.

main() runs once per sample. Not once per block — once per sample. That is why there is no modulation system to learn: anything you compute in main is already per-sample, so modulation is arithmetic rather than a feature.

advance() ends the frame. A loop with no advance() is rejected (POLE0405) rather than compiled into something that silently means "run the body once".

What it compiles to#

polec emits an object file and a C header. Link them and Pole is not present at run time: no JIT, no LLVM, no Pole library. The compiled code only calls libm, the C math library the operating system already has. The same compiler emits WebAssembly, which is how the block above just played in your browser.

The editor and the exported plugin run the same optimised module, and a bit-identity check holds them to it.

Why it exists#

Pole was written for Patchhaus, which needed a DSP language it could ship inside a commercial product. The engine before it was Cmajor, which comes under GPLv3 or a paid commercial license. GPLv3 does not fit a closed-source plugin, and the commercial license cost thousands. Writing a compiler is a large thing to take on to avoid a license; it was still the smaller option, and it ended somewhere better than where it started. On one Apple-silicon Mac, Pole compiled our test patches in 17–28 ms, where Cmajor, run the way Patchhaus ran it, took 0.3–3.5 s. And Pole has a wasm target, which is the reason this page can make sound.

What it is not#

It is a language for DSP, not a general-purpose one. There are no structs, no strings, no generics, no dynamic allocation and no recursion. Every loop is bounded at compile time, so every patch finishes its work for each block, even one a stranger wrote.

If you want the short version: it is small enough to learn in an afternoon and strict enough that the things it refuses are things you would not have wanted.

Where to go next#