Change Master Output from stereo to Mono

Hi,
I want to create a button in Unity to switch (toggle) between stereo and mono output. Is this possible via c#?

Thanks! :slight_smile:

Hi, It looks like you can do this by setting the software format from the core system.

var core = FMODUnity.RuntimeManager.CoreSystem;
core.setSoftwareFormat(0, FMOD.SPEAKERMODE.MONO, 0);

Here’s the page in the documentation: System::setSoftwareFormat

1 Like

Hi, Aishi!! Thanks for your help.

I tried to implement this button, but it’s not working.

I still have doubts related to what comes after FMOD.SPEAKERMODE.STEREO, ____

But anyway, even the mono didn’t work.

Here’s my code:

public void ToggleMonoStereo(bool isMono)
{
    if (!isMono)
    {
        MasterMono();
    }
    else
    {
        MasterStereo();
    }
}


public void MasterMono()
{
    var core = FMODUnity.RuntimeManager.CoreSystem;
    core.setSoftwareFormat(48000, FMOD.SPEAKERMODE.MONO, 0);
}

public void MasterStereo()
{
    var core = FMODUnity.RuntimeManager.CoreSystem;
    core.setSoftwareFormat(48000, FMOD.SPEAKERMODE.STEREO, 1);
}

System::setSoftwareFormat only works when called before the System is initialized. The last parameter is only really relevant for FMOD.SPEAKERMODE.RAW, so you can leave it at 0.

Thanks for the clarification, Mathew!

So it’s not possible to change from stereo to mono during runtime?

Yes and no.

As Mathew said, it’s not possible to change the channel count of your game’s output at runtime without destroying and rebuilding the Studio system.

However, it is possible to make your game switch between outputting stereo format and outputting the same mono signal to both channels by using a combination of sends and return buses. In FMOD Studio:

  1. Create a discrete global parameter with a minimum value of 1 and a maximum value of 2.
  2. Create a group bus routed into your project’s master bus, and name it “Stereo.”
  3. Take all the buses and events currently routed into your master bus, and route them into the Stereo bus.
  4. Create a new return bus routed into your project’s master bus, and name it “Mono.”
  5. Select the “Mono” return bus, and set its output format to mono.
  6. Select the “Stereo” group bus, and add a pre-fader send to the Mono return bus to its signal chain.
  7. Automate both the send and the fader on the global parameter you created back in step 1, such that when the global parameter is set to 1 the send’s volume is 0 dB and the fader’s volume is -oo dB, and when the global parameter is set to 2 the send’s volume is -oo dB and the return’s volume is 0 dB.

This setup will ensure that when the global parameter is set to 2, your game’s output will be stereo; but when the parameter is set to 1, your game’s output will be downmixed to mono and output equally on both channels. This should allow you to treat the output as switching between stereo and mono for most practical purposes.

Alternatively, if you prefer not to use a global parameter, you could instead set the send to -oo dB and the fader to 0 dB, and create a snapshot that sets the send to 0 dB and the fader to -oo dB when an instance of the snapshot is active.

1 Like

Thanks a ton, Joseph!! It worked perfectly for my needs!!

Sorry for bringing up an old thread, but this is exactly what I want to try in order to enable a Stereo toggle in my game that can be changed at runtime by the user. I think I figured how to do steps 1 - 6, but I am new to using FMod, and I am not sure how to do step 7. How do you automate a send and a fader and tie it to the global parameter? As in what do you click where in FMod studio and in what order in order to do that?

To automate a send or fader, first select the bus containing that fader or send in the mixer window, so that the send or fader is displayed in the deck. Then, right-click on the fader knob or send level knob in the deck, and select “Add Automation” fro mthe context menu. This adds an automation widget to the property.

Once you’ve added an automation widget to a property, you’ll need to add a parameter to it, and create an automation curve on that parameter. To add a parameter to an automation widget, click the “Add Curve” button, then select the global parameter you want to use, or click “New Parameter” and create a new global parameter that you intend to use.

To add an automation curve on that parameter after adding that parameter to the automation widget, click on the red dashed line to add an automation point, then click on the red line to add more automation points. Click and drag these points to various locations in order to define the shape of the automation curve. In your case, you want to automate the send’s level property such that it is 0 dB when the parameter is set to 1 and -oo dB when it is set to 2, and you want to automate the fader such that it is -oo dB when the global parameter is set to 1 and 0 dB when it is set to 2.

Thank you, is this correct?

That looks correct, yes.