Search Unity

Different Audio for different output sources

Discussion in 'Scripting' started by metigel94, Oct 11, 2019.

  1. metigel94

    metigel94

    Joined:
    Oct 11, 2019
    Posts:
    12
    Hi!

    I'm currently working on a university project where I need to split the audio of my scene between two devices. In theory, I want to have ambient sound playing on my VR headset and some other sounds playing from my pc speaker / Mini-jack.
    Is there some way to have different audio for different output sources?
    I found an addon on the Asset store that's called "AudioStream", but I cannot afford that. Do you guys have any experience or a tipp that could lead me in the right direction?

    Cheers!
     
  2. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    2,836
    My Google searches suggest that Unity doesn't have support for choosing your audio output device. I found this thread where someone who appears to be the author of the asset you mentioned says they used an FMOD package to do it, but it sounds like even with that it took special effort to integrate it with Unity's AudioSource components and their initial version required non-Unity sound output.

    So I guess you could look into FMOD, but my guess is that this won't be easy.

    You could also consider contacting the author of that asset. I assume that plugin authors typically wouldn't be very receptive to someone who is trying to recreate their work to avoid paying for it, but I could imagine someone making an exception for a university student. (I don't know the person in question, so I'm only making generalized guesses.)
     
  3. Research fmod. It works properly: https://qa.fmod.com/t/change-audio-device-in-unity/12010 (although this is partly about the event when the player connect/disconnect devices on the fly, but also applies to you how to change output device).
    Maybe you can ask them if this is possible inside the Unity system as well (the native Unity sound system is a custom fmod in reality).