## genish.js

##### one sample at a time, please.

genish.js is a library to help develop optimized audio callbacks employing per-sample processing techniques. This enables signal processing that is not possible using buffers, for example:

- chaotic oscillators
- fm feedback
- feedback delay networks
- physical modeling
- audio-rate modulation of scheduling

In our opinion per-sample processing is also easier to reason about than processing in blocks of hundreds of samples at a time. Process a sample in unit generator `A`, then feed it into unit generator `B`. And then feed the result back into unit generator `A` to influence the next sample if you want.

The trade-off is efficiency, which is especially important in a dynamic runtime environment like what JavaScript offers. Accordingly, genish takes the audio graphs you write and creates an optimized callback from them. The code generation step minimizes branches, consolidates memory for the audio callback into a single heap, and removes any traversal of scope / prototype in the callback. Below is an example of a genish.js graph to create a two-operator FM gong sound (taken from the genish tutorial).

genish.js is inspired by the gen~ extension for Max/MSP.