Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Accessing Unity's audioContext to use createBiquadFilter in WebGL

Discussion in 'Web' started by MennoB, Mar 13, 2024.

  1. MennoB

    MennoB

    Joined:
    Apr 25, 2016
    Posts:
    3
    Hi all,

    I'm working on a webgl project where I would like to use basic audio effects, mainly filters. I came into this assuming the built-in audio effects would work but unfortunately they are not supported in WebGL. I tried searching some assets or plugins that tackle this problem but I haven't been able to find any. For starters, if anyone does know of one, I would be grateful if you could point me towards it, although threads like this one don't give much hope.

    I've also begun looking into doing this myself, and it seems like I would have to add some custom javascript code. For this, I'm wondering if there is a possibility to access and modify the audioContext (or multiple contexts, not sure yet if there is a seperate context per AudioSource or something) as I'm thinking of using audioContext.createBiquadFilter as shown in this Stackoverflow post.

    Alternatively I might have to bypass Unity's audio system completely and create a new audioContext, although it seems like that could come with a new set of problems (eg accessing the files etc.).

    If you have any experience or insights to share on how to get this done I would be very thankful!