CoffeeCollider
CoffeeCollider copied to clipboard
Write out an audio file
:+1: we need this:)
The way i achieved that:
-
add recorder.js
-
run your CC code, so the object "cc.impl.api.jsNode" gets created ( i guess its only created the first time you run something )
-
plug then together then use the recorder api:
@rec = new Recorder cc.impl.api.jsNode, workerPath: "vendor/recorderjs/recorderWorker.js"
cc.impl.api.jsNode
refers to the deep internal structure.
you should use cc.getWebAudioComponents()
instead.
cc.getWebAudioComponents()
returns an array that contains AudioContext
and ScriptProcessorNode
(this ScriptProcessorNode is same of cc.impl.api.jsNode).
[ context, jsNode ] = cc.getWebAudioComponents()
@rec = new Recorder jsNode,
workerPath: "vendor/recorderjs/recorderWorker.js"
ScriptProcessorNode
is created after cc.play
at first time.
awesome! thanks for the explanation !
And is there a way of getting one "jsNode" for each block of executed code?
jsNode is created at only once and it is shared by every code.
but, multiple nodes.. it may be very good idea to be used as multitrack.
thanks!
exactly!
the way i see is: when you run a code you shall be able to get a node for that, and all nodes by default are connected to the "main" jsNode from "cc" which is the one that goes to the output.
but being able to retrieve the node for each execution will give you extra routing options, you will be able to mix them from and external GUI, or route it through some non-coffee-collider efx, etcs.
awesome stuff @mohayonao ! thanks
keep rocking!