My name is Ludo, and we are developing a 2D game with Unity and FMOD, Aku, Rebirth of Shadows (Once Upon a Time Studio (@ouat.studio.aku) • Instagram photos and videos).
Being a sound engineer by training (and working so far on Hardware and Pro Tools), I took charge of the sound part and I trained myself on FMOD using tutorials on Youtube (I have no code base).
We are now encountering two problems.
Some tracks (notably the scatterer instrument) do not play on Unity. For example, on the attached screenshot, the Ducks and Frogs tracks do not play once on Unity. I specify that I used the basic Spazializers of FMOD that seemed to sound good in my FMOD Events, I did not switch the Spazializers to stereo.
The volumes are wrong. Once on Unity ; whether Unity plays the sound with the Banks or with FMOD as a slave, the rendering is not at all like to what I mixed in FMOD. I also attach lines of code that the coder made, in case it would be the code that would prevent Unity from reading my FMOD rendering. See the lines at the bottom of the post.
Thanking you in advance for your answers, I’ll see you soon!
using FMOD.Studio;
using FMODUnity;
using MoreMountains.CorgiEngine;
using MoreMountains.Tools;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Aku
{
public class FMODManager : MMSingleton,
MMEventListener
{
// TODO: To replace once PlayerSettings will be developed.
private float _masterVolume = 1f;
private float _musicVolume = 1f;
private float _ambienceVolume = 1f;
private float _sFXVolume = 1f;
using FMODUnity;
using UnityEngine;
public class Play3DSound : MonoBehaviour
{
public EventReference fmodEvent;
// Update is called once per frame
void Update()
{
//Press Key P to play the sound
if (Input.GetKeyDown(KeyCode.P))
{
PlayFMOD3DSound();
}
}
public void PlayFMOD3DSound()
{
// Creates an instance of the event
FMOD.Studio.EventInstance soundEvent = RuntimeManager.CreateInstance(fmodEvent);
// Sets the 3D attributes so that the sound plays at this GameObject's position
FMOD.ATTRIBUTES_3D attributes = RuntimeUtils.To3DAttributes(transform.position);
soundEvent.set3DAttributes(attributes);
// Starts the event
soundEvent.start();
// Releases the event instance to free resources after it has finished playing
soundEvent.release();
}
}
Unfortunately, I wasn’t able to reproduce the issue from my end. Would it be possible to elaborate more on how you play the sound in Unity? Are those sounds all 3D sounds? Could I get some screenshots of how you set up the events in FMOD studio as well?
From the code snippet, I can see the volume variables are initialized but I can not see whether they are actually being used to set the volumes in FMOD.
If they are global settings, they should be linked to FMOD Buses. Here’s how you might set a global volume for all sounds:
// Example of setting volume for an FMOD parameter
public void SetVolume(float volume)
{
FMOD.Studio.Bus masterBus = FMODUnity.RuntimeManager.GetBus("bus:/Master");
masterBus.setVolume(volume);
}
Hope this helps, let me know if you have questions.
We do not have an FMOD error message in Unity.
I made you a video to help you understand the problem. You can download the video on the following link (I could not upload it directly in response to the post).
On the video I first launch the sound from FMOD, the scatterer instruments are audible and the projectile level is laoud. The sounds are well rooted in buses connected to the BUS MASTER.
Afterwards, I listen to the FMOD EVENT, directly in Unity from the FMOD Browser. The sounds play correctly.
I then switch to play mode in Unity. There, the sounds are wrong. The scatterer instruments no longer play and the level of the projectile, for exemple, has nothing to do with it.
Do you have any advice to give us? The coder is also reading you and any answer could save us precious time.
Thanks again for your answer.
Wishing you a nice evening (because it’s getting late here :D)
It seems the issue may be related to spatializer settings, particularly because FMOD 3D sound is influenced by the distance between the FMOD listener and the sound source. If we are talking about projectile sounds or similar effects, adjusting the maximum distance of the sound event might resolve the issue.
Could you please try increasing the max distance setting on the Spatiazlizer of the projectile sound event as well as the max distance setting on the Scatter of the scatter events in your FMOD Studio and check if the volume then behaves as expected in Unity?
First of all, thank you for these helpful answers.
As for the sound issues with action-type events, which weren’t playing at the correct volumes, I was able to resolve the issue by adding a spazializer and setting “distance attenuation” to “Off” (perhaps due to its master with the “Min & Max Distance” at the default setting).
As for ambient tracks, in events, the audio tracks play normally, but the problem persists in the “Scatter Instruments.” I modified the “Min & Max Distance” of the “Scatter Instruments” as you mentioned. Now we hear the sounds in some places in the Unity scene, but not everywhere and not at the correct volumes. (This also causes another problem with too many volume differences between the tracks that play).
So the problem seems to stem from the fact that as soon as there’s a 3D spazializer, our sounds don’t follow the camera. What we’d like is for the rendering I get when playing a “play” in FMOD’s events are exactly the same as those played in Unity; with no volume differences or anything. Should we create a script to force Unity to play FMOD’s 3D elements, locked to the camera?
FMOD Manager manages our musics and ambiences, and Corgy Engine manages the sounds effects. The problem is the same in both cases.
If you can’t solve the problem like this, I can also make a recording for you according to your request.
Thanks for everything and I look forward to hearing from you.
I am glad to hear that you have solved the issues with the action-type events!
It does sound like the primary challenge now is ensuring that the 3D sounds properly follow the listeners’ position. Achieving the exact same sound in Unity as you hear in Studio can be challenging due to differences in how audio is processed in each environment.
If removing the spatializer and switching to 2D sounds isn’t suitable for your project, adjusting the 3D attributes dynamically based on the camera’s position is indeed a practical solution. For example:
// Update the 3D attributes to match the camera's position
FMOD.ATTRIBUTES_3D attributes = RuntimeUtils.To3DAttributes(yourCameraTransform.position);
yourSoundEvent.set3DAttributes(attributes);
This will ensures that the 3D sounds are perceived as coming from the direction of the camera, thus maintaining a consistent audio perspective.
If the issue persists, recording a session and sharing it would definitely be very helpful for further investigation. It would allow me to see how the 3D sound positions are being calculated relative to the listener in real-time gameplay scene.