How can I access the instance Id for an AudioSource returned by JS_Sound_Create_Channel?

I’m working with uLipSync in WebGL. uLipSync uses OnAudioFilterRead which is not supported for WebGL, so I’m looking at writing a simple JS plugin that can (roughly) do the same. There is a project that provides experimental support:

Looking at the code however, I don’t believe it would support multiple Audio Sources. In Audio.js, I can see that JS_Sound_Create_Channel generates a new int Id for every “channel” created. I’m assuming (but it’s not clear) that a Channel here maps to an AudioSource.

Is there any way to find this id given an AudioSource? Optionally, I see each Channel is created with unique userData. Is this value available through reflection or similar?

Alternatively, if there’s any other way to get the samples from a streaming AudioClip in WebGL I’d love to know.

Unity does not support getting audio data from an AudioClip in WebGL due to browser security restrictions, sadly…

As for your first idea, while it is possible to edit Unity’s JS code and would be necessary to expose the userData, I think it’s a slippery slope. I got to admit that I am not super familiar with that part of our codebase yet though… I’m curious to hear other thoughts on that matter too!