Search Unity

Question Custom AudioWorkletProcessor(s) in WebGL

Discussion in 'Web' started by FvanHoof_Talespin, Jul 19, 2023.

  1. FvanHoof_Talespin


    May 16, 2023
    I'm trying to add a custom audioworkletprocessor-node to my project in order to send some audio-samples back to Unity (for analysis & further processing).

    However, I'm not seeing any documentation on how to add (custom) classes to javascript using jslib.
    Can anyone give me some more information on how to do this?

    Some more info on the project:
    - Unity is running inside of a React Web-App (using react-unity-webgl)
    - The AudioWorkletProcessor is to be added to the WEBAudio-Context in a jslib (from a C#-call).
    - The processor writes to a Float-array, then send the written length to Unity using a SendMessage-call (this is far faster than sending the entire array as a string).
    - It's currently up & running using
    WEBAudio.audioContext.createScriptProcessor() -> onaudioprocess
    , but I need to add some more nodes to this (and createScriptProcessor() has been deprecated for a while now).