Pitch detection with Csound WASM csound

Hi folks, I’m hoping to use Csound for some real-time pitch detection as that is what I already do in Max. In that context, I have csound output control values to a control channel, which I pipe into Scheme where I do all the actual note detection heuristics (e.g. “for how long on a pitch should we wait to consider stable”, etc).

I’m wondering if anyone has done this with Csound WASM successfully and if so, what you settled on. Specifically I’m wondering if polling the csound object from JS works adequately, or whether this is the kind of thing where I should roll up my sleeves and be using the low level libcsound from my own WASM worker - I have done that level of wasm audio coding in C/C++ before, but it would be nice to avoid it if I don’t need to.

I suppose for best latency and performance the ultimate root is doing the heuristics in C in a custom audio worklet, but I would be fine with a “good enough” solution for now as I’m not sure yet how good I really need the performance and latency to be.

Pointers and links to examples most welcome!

thanks!