OptionalblockOptionalfactoryBuilds the core for a sample rate. It is shipped to the worker as text, so it must be self-contained: no closures, no imports, everything it needs inside its own body.
OptionalfactoryInstead of factory: the text of a JavaScript expression that evaluates to the factory, for a
core that cannot be self-contained because it has imports. Bundle the core into one classic
script (an IIFE, with a bundler such as esbuild) whose last expression is the factory, e.g.
(() => { ...bundled code...; return (rate) => new Core(rate); })(), and pass that text.
Optionalmode'auto' tries a worker and falls back to the main thread; 'inline' never uses one; 'worker' fails instead of falling back. 'auto' when omitted
Optionalprefetchwhether the host renders ahead as soon as it is made (true when omitted). Turn it off when a
piece is about to be started with start: a core that has already rendered a second of
silence is not in the state of a fresh one (a modelled instrument's noise generator keeps its
place through reset), so the piece would sound slightly different from a direct render.
Optionalqueueseconds of rendered audio kept ahead of the playhead; 0.3 when omitted, which is also the latency of a message sent now
frames per render request; 1024 when omitted