Put Noise in your own site
Everything above runs on
@noiselang/core —
the Noise engine compiled to WebAssembly behind a small typed API. The .wasm
ships inside the package and bundles into your build (Vite, Rollup, webpack 5,
esbuild), so embedding the same engine takes two steps:
terminal
npm add @noiselang/core app.ts
import { run } from '@noiselang/core';
const result = await run(`
X ~ rand::unif(-1, 1);
Y ~ rand::unif(-1, 1);
4 * P(X^2 + Y^2 < 1)
`);
console.log(result.value); // "3.1415…" — the last statement's value
console.log(result.output); // everything Print(...) emitted run never throws — failures come back on result.error with a
source span. There's also runWithIntrospection for programmatically
inspecting a program's variables. Full API and bundler notes in the
package README;
the language itself is documented in the guide.