by vdnkh · 10y ago · 0 comments
This is the key I was missing in my implementation. Another challenge is wiring this up to multiple OscillatorNodes - the docs say a ScriptProcessorNode can only have one input. In my implementation I create a new OscillatorNode whenever you press a key.
If you do it that way, you just need to attach the recorder to the master output of the mixer.
it's also decent practice to send your oscillators into a mixer anyway so that they can be rerouted at large.
for instance, say you have 4 oscillators, 2 fx buses and an output. you route (4 oscillators) -> mixer -> fx bus 1 -> output. then if you want to switch the fx bus for your oscillators, you can just reroute the mixer instead of each oscillator individually.
in the case of a recorder, you'd want the end of your entire graph to look like this: mixer -> recorder -> output. this way your recorder is capturing all audio (oscillators, effects, etc). (and, as noted above, you have the option to reroute the mixer directly to the output when it's not recording).
You could have it as simple as 1 gain node for each channel which you use for input and output to the mixer master gain. This would make it difficult to add fx later though.