Conversation
ba79b1c to
c65585a
Compare
|
This also has the potential to fix an annoying hack - if you look at the definition of |
|
This is a great pull request - you've well understood the original design, you have explained your intent very clearly and you're solving a real problem. One thought I had - is it worth considering a more minimal API e.g. this branch? Once you have access to the raw node, you can do anything you like to it, so it's not strictly necessary to have them in CLJS Bach itself. Then again, it could be pretty convenient if it's a common use case. What do you think? |
|
Thanks very much @ctford, apologies for the delayed response. That's a good point that returning the raw node does allow the users to perform any operations they want without extra functions in the library. However, one downside I can see to removing the ramp functions is that JS interop would be required by the user to make use of the native linear and exponential ramps, and I also found the |
I've put together a collection of functions that provide support for inputs* (which are
ConstantSourceNodesin the web audio API: https://developer.mozilla.org/en-US/docs/Web/API/ConstantSourceNode)This resolves #2, as inputs can be used as source nodes for the parameters of other audio nodes (via the
jackfunction), and their values can be directly set (viaset-input!,lin-ramp-input!, andexp-ramp-input!) by other code (such as MIDI event callbacks).The following example code demonstrates:
It is also worth noting that the
ConstantSourceNodeis relatively new to most web browsers (I believe Chrome and Firefox added support in March), though a polyfill does exist at: https://www.npmjs.com/package/constant-source-node*I chose the name "input" as I felt that it better reflected the use-case in cljs-bach than
ConstantSourceNode, but am happy to change it to something else.