$ account sebpiq
WebPd is a compiler and runtime system that translates Pure Data (Pd) audio patches into JavaScript or WebAssembly, enabling real-time audio synthesis and processing in web browsers and Node.js environments. The codebase is structured as a TypeScript monorepo with a CLI tool (`webpd`), a browser runtime using AudioWorklet, and a comprehensive library of Pd object implementations (147+ objects). The core compilation pipeline parses `.pd` files, resolves abstractions, optimizes DSP graphs, and generates self-contained output formats including `.js`, `.wasm`, `.wav`, and standalone HTML apps. The architecture is modular: the `src/nodes/` directory contains individual builder and runtime implementations for each Pd object (osc~, dac~, filters, delay lines, message objects, etc.), all following a consistent `NodeBuilder` pattern with `translateArgs` and `build` methods. The compiler (`src/compile-dsp-graph/`) handles graph transformations like implicit signal mixing and message-to-signal conversion. The runtime layer (`src/environments/browser/`) provides initialization, AudioWorklet integration, and message passing between JavaScript and the compiled patch. The codebase demonstrates strong engineering practices with extensive parameterized tests that verify both JavaScript and WebAssembly outputs against golden fixtures. However, it is in alpha status (v1.0.0-alpha.14) with many incomplete features (e.g., `readsf~` state machine, `list` operations, `expr` if-form) and several TODO comments. The project relies on internal packages (`@webpd/compiler`, `@webpd/pd-parser`) that require coordinated builds, and some generated code strings are embedded in runtime files, creating potential maintenance friction. Despite these caveats, the compiler design, test infrastructure, and Pd compatibility are noteworthy.