4 ms·
Does this support writing audio sample processing code in JavaScript? From the examples it looks like JavaScript code connects together pre-existing audio proce
by stefanha 5y ago
Does this support writing audio sample processing code in JavaScript? From the examples it looks like JavaScript code connects together pre-existing audio processing nodes, but it's unclear if you can write your own nodes in JavaScript.
Also, the use of the term "pure function" confused me. Pure functions have no side-effects (https://en.wikipedia.org/wiki/Pure_function https://en.wikipedia.org/wiki/Pure_function). Why is this necessary? It seems like non-pure functions could generate the graph of nodes too, so restricting ourselves to pure functions seems like a limitation. Or does the term "pure function" actually mean "in functional programming style" (i.e. functions, not objects) in this blog post?
- trypwire 5y ago> Does this support writing audio sample processing code in JavaScript? Currently, no. My intention is that the library of pre-existing nodes is both complete enough and low-level enough that 95% of things end users may wish to write can be done through this composition. That said, the embedded runtime engine is designed to be extended with your own C++ processors if you have an application which particularly needs that level of customization. And why pure functions? Functions with side effects don't compose the way that pure functions do, because you can't rely on deterministic output given a consistent input. If you choose, you can still write your own non-pure functions to assemble your signal graphs, though I personally wouldn't recommend it :) The Elementary library will always aim to be strictly pure functions.
- stefanha 5y agoThanks for the reply. I see parallels to the Web Audio API (https://www.w3.org/TR/webaudio/ https://www.w3.org/TR/webaudio/) which is mostly for creating graphs of nodes using the browser's native code to do the processing. It's hard to do real-time audio sample processing in JavaScript since the language isn't designed for real-time. Maybe a restricted subset would work.