No sound issue (no error or warning)

Hello, I’m trying to use FMOD 2.03 with Unity 6, but There’s no sound out from Editor.

Please note that I only use LowLevelAPI as I need to load files from external assets
(cuz i’m making a rhythm game)

Here’s code and FMOD settings on my project

        // class variables
        private FMOD.System fmod;
        private FMOD.ChannelGroup channelGroup;
        private List<FMOD.Channel> channels;
        private FMOD.Channel bgmChannel;
        private FMOD.Channel previewChannel;
        private FMOD.Channel hitChannel;

        private Dictionary<string, FMOD.Sound> soundLib;

        private static SoundControllerFMOD instance;
        public static SoundControllerFMOD Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new SoundControllerFMOD();
                }
                return instance;
            }
        }

        // Global singleton FMOD init here
        public SoundControllerFMOD()
        {
            FMODUnity.RuntimeManager.StudioSystem.getCoreSystem(out fmod);

            fmod.setOutput(FMOD.OUTPUTTYPE.AUTODETECT);
            fmod.init(512, FMOD.INITFLAGS.NORMAL, System.IntPtr.Zero);
            int device;
            Guid guid;
            int systemrate;
            SPEAKERMODE mode;
            int modechn;
            string name;
            fmod.getDriver(out device);
            fmod.getDriverInfo(
                    device,
                    out name,
                    256,
                    out guid,
                    out systemrate,
                    out mode,
                    out modechn
            );
            Debug.Log("DEVICE NAME: "+name);

            channels = new List<FMOD.Channel>();
            channelGroup = new FMOD.ChannelGroup();
            soundLib = new Dictionary<string, FMOD.Sound>();
        }

        // Sound play here
        public void PlayBGMSound(string name)
        {
            Debug.Log("FILE" + name);
            FMOD.RESULT result = fmod.playSound(
                soundLib[name],
                channelGroup,
                false,
                out bgmChannel
            );
            Debug.Log("BGM RESULT: "+result.ToString());
            bgmChannel.setVolume(Const.VolumeMaster * Const.VolumeSystemBGM);
            float vol;
            bgmChannel.getVolume(out vol);
            Debug.Log("BGM VOL: "+vol.ToString());
            FMOD.RESULT rst = bgmChannel.setMode(FMOD.MODE.LOOP_NORMAL);
        }

I don’t care about project cuz I don’t use studio API. Just a simple empty project file is here

FMOD Settings

Unity Project Settings - Audio

Global Volume is max and Disable Unity Audio checked.

playSound method gives me FMOD_OK, and volume is not 0

image

Unity is not muted

Channels has sound assets (channel keep changes as I make createSound methods) but actual volume is always -80 db


There’s no error, no warning, no other signs and no sound.

I tried in both Windows and Mac, and neither does not work.

Any help will be appreciated

Thanks

A little update,

I uncheked Disable Unity Audio then I got sound working… (in both Windows and Mac)
but afaik, it should be checked.

How should I change my settings?

Hi!

A few questions:

  • Is there any particular reason you’re re-initializing the CoreSystem in SoundControllerFMOD()? RuntimeManager handles the entire lifetime of the FMOD System, and will have already initialized it. Try using the CoreSystem without reinitializing and see whether that helps.
  • Where is the channelGroup being passed to fmod.playSound() in PlayBGMSound() coming from? Is it the one created in SoundControllerFMOD()?
  • Can I get you to set your logging level to “Log” and enable API error logging, and post a full log from Unity where the issue is occurring?

Hi @Leah_FMOD , thanks for response.

About Initializing CoreSystem and channelGroup parameter

SoundControllerFMOD is a singleton instance which wraps initialization, play, pause, stop, memory management, preload, everything.

as it is a singleton instance, constructor will be executed only once during the entire game

Here’s whole SoundController class that I made

as you can see from the code, channelGroup is in this class too.

soundLib dictionary ( Dictionary<string, FMOD.Sound> ) is used to store keysound for each file so that I can easily find preloaded sound key file.

About Logs

I found that there was initialization error in the middle of API logs

but this error also displayed when I unchecked Disable Unity Audio and sound working.

(for both Windows and Mac)

// on Windows

[FMOD] System::init(2048, 0, 0000000000000000) returned ERR_INITIALIZED for SYSTEM (0x1E178244038).
UnityEngine.Debug:LogError (object)
FMODUnity.RuntimeUtils:DebugLogError (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:594)
FMODUnity.RuntimeManager:ERROR_CALLBACK (intptr,FMOD.SYSTEM_CALLBACK_TYPE,intptr,intptr,intptr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:142)
FMOD.System:init (int,FMOD.INITFLAGS,intptr) (at Assets/Plugins/FMOD/src/fmod.cs:1205)
BMSPlayer.SoundControllerFMOD:.ctor () (at Assets/Scripts/Core/Sound/SoundControllerFMOD.cs:40)
BMSPlayer.SoundControllerFMOD:get_Instance () (at Assets/Scripts/Core/Sound/SoundControllerFMOD.cs:29)
MusicListSoundCtrl:Awake () (at Assets/Scripts/MusicList/MusicListSoundCtrl.cs:19)


// on Mac

[FMOD] System::init(2048, 0, 0x0) returned ERR_INITIALIZED for SYSTEM (0x1386F0008).
UnityEngine.Debug:LogError (object)
FMODUnity.RuntimeUtils:DebugLogError (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:594)
FMODUnity.RuntimeManager:ERROR_CALLBACK (intptr,FMOD.SYSTEM_CALLBACK_TYPE,intptr,intptr,intptr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:142)
FMOD.System:init (int,FMOD.INITFLAGS,intptr) (at Assets/Plugins/FMOD/src/fmod.cs:1205)
BMSPlayer.SoundControllerFMOD:.ctor () (at Assets/Scripts/Core/Sound/SoundControllerFMOD.cs:40)
BMSPlayer.SoundControllerFMOD:get_Instance () (at Assets/Scripts/Core/Sound/SoundControllerFMOD.cs:29)
MusicListSoundCtrl:Awake () (at Assets/Scripts/MusicList/MusicListSoundCtrl.cs:19)

Full logs on Windows

Full logs on Mac

note, it worked when I used Unity 2021 with FMOD 2.01

Thanks for the logs and code!

RuntimeManager is similar to your own class SoundControllerFMOD, in that it’s a lazy-loaded singleton. Usually, the FMOD Studio listener component is responsible for the first call into RuntimeManager, which causes it to create and initialize its Studio System. By the time fmod.init() is called in SoundControllerFMOD, the system fmod that is retrieved is already initialized, leading to the ERR_INITIALIZED error.

This may or may not be the reason why you’re not getting any sound, but I’d recommend removing the call to fmod.init() in SoundControllerFMOD and any other similar functions that return an error as a test, and see whether that makes any difference.

Since you only want Core API features, you will likely want to do one of the following things:

  • Don’t interact with RuntimeManager at all, and instead create and initialize your own Core System in SoundControllerFMOD by interacting with the Core API’s C# wrapper directly. If you do this, you may wish to remove most/all of the FMOD for Unity integration code from your Unity project
  • Leave the FMOD for Unity code as is, and either modify the code in RuntimeManager to suit your needs, and/or modify your own code to interact with RuntimeManager in a way that doesn’t interfere with how RuntimeManager is managing its FMOD system

If resolving the ERR_INITIALIZED error doesn’t resolve the issue, the fact that sounds are successfully being created and played but no output is occurring indicates that there’s either an issue with the output itself, or that the sounds aren’t connected to the mixer properly.

In this case, could I get you to modify RuntimeManager to pass the PROFILE_ENABLE and PROFILE_METER_ALL Core API flags to studioSystem.initialize() (~line 381), and use the Core API FMOD Profiler tool included with the FMOD Engine installer at ./bin/FMOD Profiler.exe to see whether your created channels are connected to the DSP graph as expected? If you could share a screenshot from the Profiler here, that’d be great.

Enabling the “show volume” option when using PROFILE_METER_ALL flag will visualize metering in the Core API Profiler, and should help in observing signal slow throughout the DSP graph: