Calling StudioEventEmitter from code is always playing the first value of Parameter list

I’m having an issue when working with FMOD 2.02.07 for Unity 2022.1.1f1.

Our sound designer has implemented music and SFXs for the project, but I am experiencing some weird issue when playing the latters, and I guess it has to do with my setup in Unity, or code behaviour. There are two different scenarios going on:

First, for specific audio effects for one “minigame”. In it, there is only one StudioEventEmitter component, and for each action of the card minigame (drawing a card, placing it on the table, etc.) I play a different sound of that event’s pool, but when doing so the EventEmitter is playing two sounds at once (the one I played and the 0 value of the parameter’s list) overlapping them. I have recorded a video capture explaining it and showcasing the problem so you can have a better understanding of the situation:

· Multiple sounds overlapping

Also, another problem I’m having has a different outcome, but I feel that it might still be related. When moving the main character, we play in its own StudioEventEmitter some sounds of steps, different when it is walking or running. It is mostly working as intended, but every time we switch from Walking to Running, the first running step still plays the walking sound, and then updates correctly and keeps playing the correct running sounds. Again, I have recorded this behaviour with a short explanation:

· Sound value restarting

In both cases, the first sound value of the parameters’ list of that particular event is the one causing the trouble, so I’m guessing it is somehow related. Both are using the same code from the same MonoBehaviour class.

Can someone please help me figuring out what could be wrong there? I’m quite sure that it must be an error on my side, I guess I’m not configuring things properly.

Thanks in advance.

Hi! I’m the Sound designer in the project. Add FMOD project screenshots. Maybe I forgot set up something in this.

To the first problem:
FMOD OBJECT: FMOD_OBJECT.png - Google Drive
PARAMETER DETAILS: PARAMETER_DETAILS.png - Google Drive

To the second:
FMOD OBJECT: FMOD_OBJECT.png - Google Drive
PARAMETER DETAILS: PARAMETER_DETAILS.png - Google Drive

Thanks in advance :slight_smile:

A bit blurry, but I think the problem is from this:
image

For what reason are you calling start and release on the EventInstance? I think this would be causing 2 sounds to play; the first time calling the event with the default parameter, which is the first sound, and then changing parameter and calling StudioEventEmitter.Play with the sound you want. It should be enough to just call StudioEventEmitter.Play and remove the start and release calls.

1 Like

Hi there Jeff, thanks for your reply.

I was about to reply to this topic as well. I ended up solving it by not depending on the StudioEventEmitter and just creating the instance at runtime, setting its parameters and playing it, like this:

With that approach, it is now working flawlessly and with no weird audio errors like before, and it is also clearer and more controlled this way.

Thanks for your answer!

1 Like