Can multiple events access the same parameter

Hey guys ,

Scenario:

“event 1” = Music event with a parameter called “health music” value 0-100
(basically music that transitions in regards to this value)

If I create a whole new event “event 2” and click add parameter “health music” (spelling identical) will the programmer control both events at the same time?

Or should I just create “event 2” as audio tracks inside “event 1” to gain access to the “health music” parameter?

Basically wondering if I create another parameter identical to another inside FMOD is it actually going to work off the same code inside a engine?

Thanks,

This is actually a pretty complex question, so I’ll need to go over several different concepts in order to cover everything.

To begin with, though: No. Even if two events the same parameter, you can’t update one and expect the other to change. (Usually, anyway. I’ll get to the exception later.) This starts to make sense as soon as you realise that it’s not events that have updatable parameter values, it’s event instances.

When you play an event in your game, you’re actually creating an instance of that event - and theoretically you could have more than one instance of that event playing at the same time. In most cases, this happens because the different sound events represent separate in-game events happening at the same time but in different places. For example, if your game had two different musicians in the same dance hall each playing wicked guitar riffs, each of those guitar riffs could be a different instance of the same guitar riff event.

Now suppose that one of your game’s frequently-instanced events has a parameter. Often, you’ll want to set the values of each event instance independently - perhaps so that our two musicians can have differing levels of fatigue. FMOD Studio supports this by making each event instance have its own independently-set parameter values. (This is especially important for events that use the Timeline. The Timeline is just another parameter, despite having some special behaviour; If event instances couldn’t have different parameter values, all instances of a timeline-using event would have to play in sync.)

That’s the heart of why you can’t set the value of all parameters with a certain name at once: FMOD Studio has no way of knowing which event instances you want to target unless you specify. Thus, if you want to set every event instance’s parameters to the same values, you need set each and every one of them.

Oh, and I mentioned there is an exception that lets one event instance’s parameter update the parameters of other event instances. This is it: If an event contains an event sound module or an event reference sound module, and the referenced event has a parameter with exactly the same name and range as a parameter in the parent event, then any instance of the referenced event triggered from that sound module will automatically update its parameter values to match those of the specific event instance that triggered the sound module. Note that because nested and referenced events share routing and position with their parent events instances, this is only useful for events where positioning and routing doesn’t matter, or where the nested event should always share the same position and routing as the parent.

As for whether you should create your ‘event 2’ audio tracks inside ‘event 1,’ I can’t say for sure whether that’s best for your project without knowing more about what you’re trying to achieve. Still, in general it’s usually easiest and cheapest to keep your events simple; If you don’t need event 1 and event 2 to share a timeline or otherwise behave as a single entity, it’s probably best to keep them as separate events and update their instances’ parameter values independently.

Incidentally, we do intend to create a “global parameters” feature that will allow you to specify certain variables that can be referenced by any event in your project, but we have not yet set a release date.

2 Likes

Joseph,

Thanks for taking the time to explain all that. I think I get the gist of the why and why not’s, very complex stuff.
I’ll do some experimenting / testing, thanks again!

1 Like

Hi FMOD team!

I’m sort of new using FMOD and recently came across with my first issue. The 2D game I’m working on at the moment has a lot of character distributed across the map. The main character should be able to hear the position (volume,panning) of the other characters based on distance. I used the spatializer mix automation linked to a parameter called gameObject form a built in parameter called distance. It worked well on one object but I didn’t on the rest of them when assigned. I’ve done quite a lot of testing which leaves with the conclusion that a parameter works just for one gameobject but that doesn’t make sense either.

Can I use the same parameter for more than one event? If so, how should I do that?

Cheers!

I’m afraid I don’t understand what you mean by this. Are you automating one parameter on another parameter? When you say you’re using the spatializer mix automation, does that mean you’re automating the mix property of a spatializer’s the pan override, and if so, why are you doing that?

If your goal is to spatialize event instances such that their panning and attenuation depends on their position relative to the listener, why are you using automation instead of relying on the spatializer’s existing ability to pan and attenuate a signal based on the event instance’s position relative to the listener?

Yes, you can use a parameter in multiple events. To use a parameter in multiple events, add it to each event you want to use it in.

If you want all the instances of those events to share the same parameter value at all times, make the parameter a global parameter. On the other hand, if you want individual event instances to have different parameter values, make sure the parameter is a local parameter.

Hi Joseph!

Thanks for you reply! Here are some comments and answers to your questions!

Blockquote
If your goal is to spatialize event instances such that their panning and attenuation depends on their position relative to the listener, why are you using automation instead of relying on the spatializer’s existing ability to pan and attenuate a signal based on the event instance’s position relative to the listener?

That’s my goal! However I left the spatializer without any extra settings but it didn’t work at first. Then I google how to spatialized sounds using FMOD and I found the following thread:

Maybe there’s another work around for this as the game I work on is 2D and I’m looking for having a good positional sound for the characters. BTW I’ve just tested without automation and I don’t get the panning / volume changes relative to the position sorry.

Blockquote
Yes, you can use a parameter in multiple events. To use a parameter in multiple events, add it to each event you want to use it in.
If you want all the instances of those events to share the same parameter value at all times, make the parameter a global parameter. On the other hand, if you want individual event instances to have different parameter values, make sure the parameter is a local parameter.

Thanks for clarifying! I wasn’t sure how it worked in spite of having read the docs

Define “good positional sound.” What behavior do you want, and how does it differ from that already provided by the spatializer effect?

Is your game’s code updating the 3D attributes of the event? What distance units does your game engine use, and what distances between the listener and emitter are you testing? How are you setting the position of the listener in the game world?

Define “good positional sound.” What behavior do you want, and how does it differ from that already provided by the spatializer effect?

What I’m looking for is the main character being able to localize other objects/characters in the game based on volume and panning. The closer the main character is to an object/other character, the louder the sound gets and also the clearer it gets to hear if it is on the right or the left. Currently the spatializer turns the volume of the assets quite down.

Is your game’s code updating the 3D attributes of the event? What distance units does your game engine use, and what distances between the listener and emitter are you testing? How are you setting the position of the listener in the game world?

This is a bit tricky since I’m working on a 2D and can’t make out your question completely.

This video shows better what I’m trying to say

https://drive.google.com/file/d/1aQdwipikoF5jG1Ss9nRgCSQZRzDsHk5D/view?usp=sharing

What is the max distance of the spatializer effect, and what distance is the emitter from the listener when it “turns the volume of the assets quite down?” By default, the spatializer effect attenuates the volume of the signal such that it is 0 dB within the spatializer’s min distance, and silent outside of its max distance.

Boosting the volume of an asset above 0 dB is not recommended, as it can potentially result in peak clipping and permanent damage to your players’ speakers, so I presume you’re not trying to do that.

Cool! Let me add some screenshots for you:

You can see the timeline view, the parameter view and the parameter set up of the event I made the video from.

I’ll be exploring with the scale of the parameter and the max distance in the meantime.

Thanks Joseph!

Looking at those screenshots, I see you are automating the pan override mix property of the spatializer effect’ pan override on distance. I’m afraid i do not understand why you are doing this. That property overrides the distance-based panning and attenuation of the spatializer effect.

I also notice that you have set the max distance of the spatializer effect to 5. This means that the spatializer will cause your event to be inaudible at distances greater than 5 distance units unless overridden by the pan override mix property. That’s not a problem in itself, but I notice you have also set the maximum value of your “gameObjectDistance” parameter to 30, a significantly higher value.

What behavior are you trying to achieve with this combination of spatialization and pan override that would not be achieved by simply setting the max distance of the spatializer effect to 30 and keeping the pan override mix property at its default value without automation?

Hi Joseph!

I was tasked something else but I’m coming back to this issue soon. You’ll get a reply after trying your suggestions

Cheers!