Search Unity

AudioClip.GetSpectrumData in webgl?

Discussion in 'Web' started by Crazy-Minnow-Studio, Apr 28, 2015.

  1. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
    This doesn't seem to be available in webgl, I believe this method previously leveraged the FMOD GetSpectrum method. Does anyone know if Unity has posted an API for webgl on what is and isn't available in the current build somewhere that I can't seem to find?

    Thanks
     
  2. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    This API is not supported and won't be any time soon - we are not using FMOD on WebGL, but a custom audio layer using the Web Audio API (which is somewhat limited in what it can do).
     
  3. gfoot

    gfoot

    Joined:
    Jan 5, 2011
    Posts:
    550
    Crazy-Minnow-Studio likes this.
  4. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
    Hi Jonas,

    Thanks for the response. I understand this is a preview build, but do you know if the plan is to build similar functionality around the Web Audio API to replicate the capabilities provided by fmod before official release, after official release, or never?

    I'm asking because we have an asset that leverages this capability, and we'd prefer to not pursue wheel reinvention if it's in the eventual official plans.

    Thanks
     
    Last edited: Apr 29, 2015
  5. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
  6. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    A lot of what FMOD does cannot possibly be replicated in FMOD. For things which can be, we will look at them one by one. I think having actual audio feature parity between WebGL and other platforms can only happen when we can run FMOD on WebGL. That, otoh, requires threading support, which WebGL does not have yet. I expect that to change eventually, but that is looking at long-term options.
     
    Crazy-Minnow-Studio likes this.
  7. Simon_says

    Simon_says

    Joined:
    Oct 19, 2013
    Posts:
    141
    Any news regarding this? Or still "not possible and won't happen soon"? I have a game which relies on audio and this is a very big limitation of this platform...
     
    Crazy-Minnow-Studio likes this.
  8. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Unfortunately, this still falls under "not possible and won't happen soon".
     
  9. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
    Simon_says,

    If you need this now you have to write it in native javascript to tap the underlying browsers implementation of Web Audio API, make calls to it from Unity, and pass data back and forth. It's clunky compared to Unity's FMOD wrapper on all other platforms, and the output data will look a bit different as well, but it does work.

    The content in these links will point you in the right direction.

    http://forum.unity3d.com/threads/webgl-lipsyncing.328728/

    http://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

    https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Visualizations_with_Web_Audio_API
     
    Last edited: Mar 5, 2016
    Simon_says likes this.
  10. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    216
    That's really sad to hear. I was planning to do a music video with a visualizer for my friend's band, only to discover that the visualizer does not react in the webgl build.
     
    radiantboy likes this.
  11. Pedro-M

    Pedro-M

    Joined:
    Nov 29, 2013
    Posts:
    3


    Please you could give as an example https://forum.unity3d.com/threads/webgl-lipsyncing.328728/
    The point is I do not know how to apply the scripts in the scene, and my English is not good enough to understand everything.
    Please build a sample case and send us, it would help a lot
     
  12. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
    For anyone interested in getting easy access to amplitude and spectrum data on the WebGL platform, we finally cracked this nut, and are offering it as a well polished asset for anyone that wants to avoid the drudgery we went through to get it all working well. We really needed this as an option to allow our SALSA Lipsync system to work on WebGL. We also created a couple of free downloadable add-on's for owners that allow easy beat detection trigger events and simple SALSA integration. For those that prefer to go it alone, the necessary information is already included in this thread.

    https://assetstore.unity.com/packages/tools/audio/amplitude-for-webgl-111277
     
  13. underseaaa

    underseaaa

    Joined:
    Feb 2, 2018
    Posts:
    2
  14. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I would like to know too, can webgl use a mic and then get unity objects reacting ? or still not possible ? I too would like to write a webgl based sound reactive app for use in clubs using the mic.
     
  15. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    did you ever figure this out?
     
  16. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    216
    No, sorry. I gave up
     
    radiantboy likes this.
  17. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    I swear I found a github repos that claimed to do it, but I cant find it again.
     
  18. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633