In the previous (Emscripten) version, we could get the Webaudio context from Csound by using
CSOUND_AUDIO_CONTEXT
We could also get the Csound node using
csound.getNode()
So for example, I could create an analyser in the same audio context and connect Csound to it
scopeNode = CSOUND_AUDIO_CONTEXT.createAnalyser();
csound.getNode().connect(scopeNode);
How is this done now in Csound WASM?
I figured out I can create an audio context
let actx = new AudioContext();
and then pass it to Csound
csound = await Csound({AudioContext: actx});
That seems to work.
So that seems to solve 1/2 my needs. The next thing is how to get the Csound node
so I can make the connection to my scope and mag spectrum plotter.
stevenyi
(Steven Yi)
3
.getNode() should work. I'm not sure why it's not in the documentation
on NPMJS, but it's in our .d.ts:
I'll ask Hlodver about the documentation issue.
I found another way just now
csound.on("onAudioNodeCreated", node => { node.connect(scopeNode); });
getNote() did not seem to have been found.
ah, if we handle the promise correctly, it works too
node = await csound.getNode();
node.connect(scopeNode);