Search Unity

Ambisonic sound in Unity (Android project)

Discussion in 'Audio & Video' started by GamerPET, Feb 27, 2017.

  1. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Hello guys!

    I have a VR project where I have to play an ambisonic file. Any idea how to do this?
    Are there any unity plugins? Even paid plugins... I just need something that works :)

    Thank You

    <3
     
  2. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
  3. phili_maas

    phili_maas

    Joined:
    Dec 11, 2016
    Posts:
    21
    I'm trying to do the same.
    Currently messing with the GoogleVR AudioSoundField object. It always spatializes the two audio clips that are attached to the object. Also you need to switch the AudioManager to GVR Audio Spatializer.

    What I need to do is extract the 2 ambisonic channels (WY and ZX) from a .mp4 video file and play it synchronously with the video. Any help would be appreciated :)
    First I will try and play it back separately with the muted video, maybe I'm lucky and it is in sync.
    When I figure out a way I will post it here.

    Cheers,
    Phil
     
    Matexyu likes this.
  4. phili_maas

    phili_maas

    Joined:
    Dec 11, 2016
    Posts:
    21
    Update:
    It's possible to sync the video stream that plays back via the android mediaplayer with the GVR Soundfield audio stream. You can get the time samples of both and sync them at the beginning.

    So the Gvr Audio Spatializer and Soundfield Object seem to work, also for GearVR.
    Aside from the googlevr sdk you could also use Facebooks plugin for ambisonic rendering:
    https://facebook360.fb.com/downloads/rendering-sdk/

    Now that I actually had time to dive deeper into this, it seems pretty straight forward do add ambisonic audio to your 360 video player within unity.

    Hope this info helps someone.
     
  5. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Right now I just manualy placed 6 sound sources. Top-Bottom-Left-Right-Front-Back ... and I placed each WAV file in that spot. WAV have been exported on their own location.

    So that Facebook SDK works?

    What do you have to do exactly in order to have an ambisonic sound played?
     
  6. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    I tried to download the FacebookSDK Unity demo... but I get an Error.
    @phili_maas

    nvm... it seems I made the demo scene work.
     
    Last edited: Mar 31, 2017
  7. DavidPumpkin

    DavidPumpkin

    Joined:
    Apr 5, 2017
    Posts:
    32
    Hi GamerPET, Im stuck in this atm and this is the last step of my app, would you mind give me a hand?
     
  8. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Download the pack from here:
    https://facebook360.fb.com/downloads/rendering-sdk/

    There you will find some Unity stuff. There is that Example-Unity5 folder. You can open that project but you will get an error. After you open that project just open the TBAudioEngine_0.9.95.unitypackage ... because the demo project doesn't have the scripts.

    If you need more help ask... but I will only be able to help tomorrow.
     
  9. DavidPumpkin

    DavidPumpkin

    Joined:
    Apr 5, 2017
    Posts:
    32
    Hi GamePET, thank you very much for your help, I had read the script but just struggling how to use it,

    I recently using GvrAudio Field but there are no sound when I output, would you mind share the process of the

    TBEngine? it would be appreciated, Many thanks!
     
  10. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Well I just opened the Demo Scene and saw how they did it.

    You need:
    1. GO (Game Object) that has : TBEngineInitialise & TBEngineDestroy
    2. GO that has : TB Spat Decoder (I named this like in the demo scene. SpatDecoder)
    3. Attach to the MainCamera: TBEngineListener

    In the SpatDecoder GO you configure the sound.
    Wen it should be loaded. When it should be played. Volume, etc.

    Make sure that your TBE file is placed in the folder "StreamingAssets".
     
  11. DavidPumpkin

    DavidPumpkin

    Joined:
    Apr 5, 2017
    Posts:
    32
    thanks GP, I got the WY and XZ channel where should I put it in?
     
  12. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    No idea how you export them... I just received a .TBE file, and that's what you feed to the plugin.
     
  13. DavidPumpkin

    DavidPumpkin

    Joined:
    Apr 5, 2017
    Posts:
    32
    ok, so your ambisonic file extension is TBE?
     
  14. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
  15. DavidPumpkin

    DavidPumpkin

    Joined:
    Apr 5, 2017
    Posts:
    32
    thank you GamerPET
     
  16. DavidPumpkin

    DavidPumpkin

    Joined:
    Apr 5, 2017
    Posts:
    32
    Hi GamePET, now I facing a problem of my project , I using Gvraudiofield but its not sync with my video, do you know is it possible to give it a 1 sec delay in it? thanks!
     
  17. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Well I use Playmaker to handle my "code". I also use AVPro to handle my video. Since AVPro does not support Playmaker yet I simply use a hardcoded "wait" event. Normally I would want to use an Event that checks when the video is loaded... only then go to the next State that plays the video & audio.
     
  18. IRALTA

    IRALTA

    Joined:
    Apr 7, 2015
    Posts:
    14
    Hello GamerPET, I'm trying to use Facebook SDK but when I try to listen in Android it doesn't know where the .tbe is.
    I have a post explaning better here: https://forum.unity.com/threads/cant-get-path-to-streamingassets-in-android.505569/#post-3298905

    Do you have to modificate SDK to load audio file on a Android device?
     
  19. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Well I had my .tbe file in the StreamingAssets. I didn't had to use any WWW.

    The TB Spat Decoder had the Asset name there and it was setup to Load on AWAKE & Play asset on NONE.

    When I was going to my play video state I was also doing this:



    And so... my audio was starting.
     
    IRALTA likes this.
  20. IRALTA

    IRALTA

    Joined:
    Apr 7, 2015
    Posts:
    14
    What version of SDK are you using?

    This is my Splat Decoder and I haven't a Call Method
     

    Attached Files:

  21. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    The Call Method thing is from PlayMaker. I'm using playmaker to call that method. You could call the method trough code also.
     
  22. IRALTA

    IRALTA

    Joined:
    Apr 7, 2015
    Posts:
    14
    I was using version 1.3.0 of SDK and it doesn't work in Android, but I had used 0.9 version and it works!!
     
    GamerPET likes this.
  23. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Weird that a newer version doesn't have support for Android while an older version has .... :D
     
  24. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    BUMP BUMP BUMP!

    Any ideas how to do this in 2018?
     
  25. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Just so other people know how to do this.

    Go here:
    https://facebook360.fb.com/downloads/rendering-sdk-v1-3-0/

    It seems that this version works with Unity 2018.1.0f2.
    Things are a bit different but pretty similar. Import the .unitypackage found in \Audo360\Unity. Then read the PDF manual that has the Unity Integration info.

    If you want to play the Audio file ... you can call a method.