CoffeeCollider icon indicating copy to clipboard operation
CoffeeCollider copied to clipboard

Write out an audio file

Open mohayonao opened this issue 11 years ago • 6 comments

mohayonao avatar Nov 01 '13 23:11 mohayonao

:+1: we need this:)

lisongx avatar Jan 06 '14 13:01 lisongx

The way i achieved that:

  1. add recorder.js

  2. run your CC code, so the object "cc.impl.api.jsNode" gets created ( i guess its only created the first time you run something )

  3. plug then together then use the recorder api:

    @rec = new Recorder cc.impl.api.jsNode,
        workerPath: "vendor/recorderjs/recorderWorker.js"
    

hems avatar May 20 '14 18:05 hems

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.

mohayonao avatar May 21 '14 01:05 mohayonao

awesome! thanks for the explanation !

And is there a way of getting one "jsNode" for each block of executed code?

hems avatar May 21 '14 16:05 hems

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!

mohayonao avatar May 22 '14 01:05 mohayonao

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!

hems avatar May 30 '14 14:05 hems