# Playing different audios simultaneously through different output devices

**URL:** https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461
**Category:** Unity
**Created:** [March 3, 2022, 9:21pm UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461 "2022-03-03T21:21:26Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Abneto](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@Abneto](https://qa.fmod.com/u/Abneto)
#### Post date: [March 3, 2022, 9:21pm UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461/1 "2022-03-03T21:21:26Z")

</div>

Hello,

I’ve been trying to play different audios at the same time but on different speakers (soundcard) using the same application, but I can’t really find a way to make it work.

After looking around a bit, I did see a [similar topic](https://qa.fmod.com/t/output-two-different-audio-files-to-two-different-sources-in-one-gameobject/16280) here, suggesting to add multiple FMOD.System in order to be able to play sounds on different outputs simultaneously, but I’m not really sure on how to properly do it, as I’m fairly new to FMOD.

I did manage to switch outputs, but all playing sounds also switch to it.

Is there another way to play audios through multiple outputs at once? If not, how can I properly link a new FMOD.System to play event instances?

---

<div class="post-metadata">

### Author: ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)
#### Post date: [March 7, 2022, 7:27pm UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461/2 "2022-03-07T19:27:17Z")

</div>

It really depends what you mean by wanting to play “different audios at the same time on different speakers”.

You can use the Channel Mix effect to force only certain channels to output audio, essentially muting one side of speakers, or you can use the [`ChannelControl::setMixMatrix()`](https://fmod.com/resources/documentation-api?version=2.02&page=core-api-channelcontrol.html#channelcontrol_setmixmatrix) if you are using the Core API.

If you are referring to outputting to multiple audio devices then you will need to run multiple FMOD systems. This is basically just running every single FMOD command twice to two separate instances of the FMOD system, but it will double the resources required to do so.

---

<div class="post-metadata">

### Author: ![Abneto](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@Abneto](https://qa.fmod.com/u/Abneto)
#### Post date: [March 7, 2022, 9:17pm UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461/3 "2022-03-07T21:17:19Z")

</div>

Guess it wasn’t very clear, but what I really meant is having multiple outputs, each one playing a different sound.

I’ve managed to do it by modifying RuntimeManager.cs and adding 3 extra systems along with the coreSystem

```auto
        FMOD.Studio.System studioSystem, studioSystem2, studioSystem3, studioSystem4;
        FMOD.System coreSystem, system2, system3, system4;

```

And then creating them itself during RuntimeManager’s intialization

```auto
            result = FMOD.Studio.System.create(out studioSystem2);
            CheckInitResult(result, "Creating System Object");
            studioSystem2.getCoreSystem(out system2);
            result = FMOD.Studio.System.create(out studioSystem3);
            CheckInitResult(result, "Creating System Object");
            studioSystem3.getCoreSystem(out system3);
            result = FMOD.Studio.System.create(out studioSystem4);
            CheckInitResult(result, "Creating System Object");
            studioSystem4.getCoreSystem(out system4);

```

And initializing them in my own script (I’m not sure if getting the number of drivers for the other systems other than the core is a required step, but I did it out of precaution)

```auto
var resGetDrivers_core = FMODUnity.RuntimeManager.CoreSystem.getNumDrivers(out int totalDrivers);
var resGetDrivers_system2 = FMODUnity.RuntimeManager.System2.getNumDrivers(out int totalDriversSys2);
var resGetDrivers_system3 = FMODUnity.RuntimeManager.System3.getNumDrivers(out int totalDriversSys3);
var resGetDrivers_system4 = FMODUnity.RuntimeManager.System4.getNumDrivers(out int totalDriversSys4);
var resSysInit_system2 = FMODUnity.RuntimeManager.System2.init(4, FMOD.INITFLAGS.NORMAL, (System.IntPtr)0);
var resSysInit_system3 = FMODUnity.RuntimeManager.System3.init(4, FMOD.INITFLAGS.NORMAL, (System.IntPtr)0);
var resSysInit_system4 = FMODUnity.RuntimeManager.System4.init(4, FMOD.INITFLAGS.NORMAL, (System.IntPtr)0);    

```

I also created the sounds using [System::createSound](https://documentation.help/FMOD-Studio-API/FMOD_System_CreateSound.html) , but I’ve associate them with the CoreSystem instead of the new systems, I still can play and access them with the others:

`var soundResult_test = FMODUnity.RuntimeManager.CoreSystem.createSound(Application.dataPath + "/StreamingAssets/" + "test.mp3",FMOD.MODE.DEFAULT, out var sound_test);`

And then finally, playing the sound itself.

```auto
//One for each system
FMOD.ChannelGroup cgSys1;
FMOD.Channel chaSys1;

FMOD.Result playResult;

//Change "CoreSystem" to whichever system you want (System2, System3, etc.)
playResult = FMODUnity.RuntimeManager.CoreSystem.playSound(sound_test, cgSys1, false,out chaSys1);

```

---

<div class="post-metadata">

### Author: ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)
#### Post date: [March 7, 2022, 9:54pm UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461/4 "2022-03-07T21:54:48Z")

</div>

Yes, that is the way to do it if you wish to output to multiple devices.

---

<div class="post-metadata">

### Author: ![ANevskiy](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ANevskiy](https://qa.fmod.com/u/ANevskiy)
#### Post date: [April 5, 2023, 3:09pm UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461/5 "2023-04-05T15:09:55Z")

</div>

Hello, Abneto! Thank you for sharing this method. I have a question: do you output sounds just to stereo channels of both audio interfaces that you have? Is it possible to dig a bit deeper and force an event to select an output of an audio interface? For example, an event goes to my Maudio audio interface and then it goes to an output 1, and a second event goes into the same interface but goes to the output 2

---

<div class="post-metadata">

### Author: ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)
#### Post date: [April 12, 2023, 10:15pm UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461/6 "2023-04-12T22:15:58Z")

</div>

I’m unable to test it, as I don’t have access to a multi-output audio interface, but as long as the audio interface represents its multiple outputs as a single system device, with each output matching a channel that the FMOD is outputting, then setting an event to be routed to only a single channel should cause it to be routed to the corresponding audio interface output. If you’re doing this, you’ll want to be aware that you won’t be able to use any spatial audio effects, as they’ll override your specific channel routing.

---

<div class="post-metadata">

### Author: ![ANevskiy](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ANevskiy](https://qa.fmod.com/u/ANevskiy)
#### Post date: [May 3, 2023, 12:06pm UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461/7 "2023-05-03T12:06:10Z")

</div>

Thanks a lot! Will try

---

<div class="post-metadata">

### Author: ![kiing\_ot](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/kiing_ot/32/6336_2.png) [@kiing\_ot](https://qa.fmod.com/u/kiing_ot)
#### Post date: [March 10, 2024, 5:09pm UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461/8 "2024-03-10T17:09:26Z")

</div>

```auto
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

public class TestMultipleOutputs : MonoBehaviour
{
    // Start is called before the first frame update
    FMOD.ChannelGroup cgSys1;
    FMOD.ChannelGroup cgSys2;
    FMOD.Channel chaSys1;
    FMOD.Channel chaSys2;
    FMOD.RESULT playResult;
    FMOD.RESULT playResult2;
    void Start()
    {
        var resGetDrivers_core = FMODUnity.RuntimeManager.CoreSystem.getNumDrivers(out int totalDrivers);
        Debug.Log($"Total Core Drivers {totalDrivers}");
        var resGetDrivers_system2 = FMODUnity.RuntimeManager.CoreSystem2.getNumDrivers(out int totalDriversSys2);
        Debug.Log($"Total 2 Drivers {totalDriversSys2}");
        var resGetDrivers_system3 = FMODUnity.RuntimeManager.CoreSystem3.getNumDrivers(out int totalDriversSys3);
        Debug.Log($"Total 3 Drivers {totalDriversSys3}");

        var resSysInit_system2 = FMODUnity.RuntimeManager.CoreSystem2.init(3, FMOD.INITFLAGS.NORMAL, (System.IntPtr)0);
        var resSysInit_system3 = FMODUnity.RuntimeManager.CoreSystem3.init(3, FMOD.INITFLAGS.NORMAL, (System.IntPtr)0);

        var soundResult_test = FMODUnity.RuntimeManager.CoreSystem.createSound(Application.dataPath +
            "/StreamingAssets/" + "system1.wav", FMOD.MODE.DEFAULT, out var sound_test);

        var soundResult_test2 = FMODUnity.RuntimeManager.CoreSystem2.createSound(Application.dataPath +
            "/StreamingAssets/" + "system2.wav", FMOD.MODE.DEFAULT, out var sound_test2);

        playResult = FMODUnity.RuntimeManager.CoreSystem.playSound(sound_test, cgSys1, false, out chaSys1);
        playResult = FMODUnity.RuntimeManager.CoreSystem2.playSound(sound_test2, cgSys2, false, out chaSys2);
    }
}

```

I’m still a bit unsure on how to define the audio output for each system. What would be the best solution for this?

---

<div class="post-metadata">

### Author: ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)
#### Post date: [March 18, 2024, 12:49am UTC](https://qa.fmod.com/t/playing-different-audios-simultaneously-through-different-output-devices/18461/9 "2024-03-18T00:49:51Z")

</div>

To set the output driver for each system, you can use [`System::getDriverInfo`](https://www.fmod.com/docs/2.02/api/core-api-system.html#system_getdriverinfo) to get info for each of the drivers - it’s intended to be used alongside [`System::getNumDrivers`](https://www.fmod.com/docs/2.02/api/core-api-system.html#system_getnumdrivers), which you’re already using, to enumerate the drivers. You can then use [`System::setDriver`](https://www.fmod.com/docs/2.02/api/core-api-system.html#system_setdriver) to specify the driver you want to use.
