Fmod sound panning (SOLVED)

Hi!

The fmod example of defold-fmod is able to pan the engine sfx setting the position of the source. I am able to to the same loading the fmod banks of the defold-fmod example in my code. But I am NOT able to do it with the sfx prepared by our musician… The sfx are stereo and I hear them as stereo, but the panning does not work!

Is there some settings in fmod studio that I am missing?

Thanks!

Ciao, Rocco!

You setup the positions etc similar to in the example for sure?

In FMOD studio do you see pan?

Maybe @dapetcu21 can post the source / a screenshot of the banks in the example https://github.com/dapetcu21/defold-fmod/tree/master/example/banks

2 Likes

Thanks @Pkeod

Yes, the script is exactly the same! I have copied it :slight_smile: Indeed if I create the “Vehicle event” of the example, the panning works.

Yes, I do confirm I have pan in FMOD Studio.

On the other hand. I was wondering if the sfx should be MONO for the attenuation / panning to work in the fmod engine. From a physical viewpoint it could make sense.

I have to say I don’t like the fmod model of attenuation / panning. It is perfect for a 3D game, of course; but for a 2D game I would be happy to just set volume/pan or left_volume/right_volume (clearly equivalent). Is this possible in fmod? I must confess that I don’t like their online documentation and also the answers in their forum. But of course, it is my fault for sure.

1 Like

I have found a way to “exclude” the attenuation/pan system of fmod and to implement a pan control. It is very easy.

  1. In the code I set the position field of the source attribute to (0,0,0), the same position of the listener.

  2. In FMOD Studio I have added a parameter, named “Pan”, with range -1, +1

  3. I have added a “automation” to the pan control of the sfx I want to pan

  4. I have added a curve to the automation, a linear interpolation: when Pan is -1 the pan is -100 and when Pan is +1 the pan is +100. (This range [-100, 100] for the pan control is built-in in FMOD Studio.)

  5. Now in the code, when I launch the sfx I have the following line:

    event:set_parameter_by_name(“Pan”, x, true)

where x is the pan in the range -1, +1.

In this way I can control the pan of the sfx via code. I hope this is correct… Note that in doing so I am completely excluding the attenuation / pan of the fmod engine. Is there a better way to exclude it? a different initialization? should I use the fmod and not the fmod studio api interface?

Thanks!

Edit: the help of a (more) experienced fmod user is greatly appreciated!

Edit2: asking some help on fmod forum… I will report here any advice for any other interested user

2 Likes

I have finally a solution for this, thank to the fmod forum (https://qa.fmod.com/t/pan-for-2d-game/16219)

It is obvious for any user of fmod but me (and our musician, he is used to wwise and this is his first project with fmod).

There are two ways to implement panning.

  1. For 3D games and also for games with a moving camera (like platforms…). Fmod has a built 3D sound spatializer, it performs attenuation and panning of the events (and also more advanced features) taking into account the positions, the orientations and the speeds of the listener and of the source. In order to use this with a sfx you have to add a “Spatializer” to the event in FMOD Studio.

  2. For 2D games you may simply use the solution I described in the above posts (using the Pan parameter and an Automation for each sfx you want to pan) and you DO NOT need to set the 3D attributes of the listener and of the sources.

My sfx didn’t worked with the built-in attenuation/panning since we had not add a “Spatializer” to them in FMOD Studio. The code worked with the “Vehicle event” of the fmod-defold example project since that event HAS a spatializer (this I am just guessing since I don’t have the FMOD Studio project…; but I am quite sure of this!).

I hope this may help some other “noob” fmod-defold user like me!

Ciao!

3 Likes