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

**URL:** https://qa.fmod.com/t/calling-studioeventemitter-from-code-is-always-playing-the-first-value-of-parameter-list/18830
**Category:** Unity
**Tags:** unity
**Created:** [June 2, 2022, 10:04am UTC](https://qa.fmod.com/t/calling-studioeventemitter-from-code-is-always-playing-the-first-value-of-parameter-list/18830 "2022-06-02T10:04:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Miguel\_TA](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/miguel_ta/32/3604_2.png) [@Miguel\_TA](https://qa.fmod.com/u/Miguel_TA)
#### Post date: [June 2, 2022, 10:04am UTC](https://qa.fmod.com/t/calling-studioeventemitter-from-code-is-always-playing-the-first-value-of-parameter-list/18830/1 "2022-06-02T10:04:51Z")

</div>

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](https://drive.google.com/file/d/1Oa8OCvW1Bg7S5_zWRo-tRYzAyNqZOE36/view?usp=sharing)

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](https://drive.google.com/file/d/1489FEmDIWOODX-e0YNbrcUd0-PoJ5Awp/view?usp=sharing)

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.

---

<div class="post-metadata">

### Author: ![Compotacustico](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/compotacustico/32/3609_2.png) [@Compotacustico](https://qa.fmod.com/u/Compotacustico)
#### Post date: [June 2, 2022, 10:50am UTC](https://qa.fmod.com/t/calling-studioeventemitter-from-code-is-always-playing-the-first-value-of-parameter-list/18830/2 "2022-06-02T10:50:08Z")

</div>

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](https://drive.google.com/file/d/1jXjVW_aMyFAH8ADKvBYAtnFUrqWICywP/view?usp=sharing)  
PARAMETER DETAILS: [PARAMETER\_DETAILS.png - Google Drive](https://drive.google.com/file/d/1_8mJhk-PGaDBK57iT90owoxCdkxDpr1f/view?usp=sharing)

---

<div class="post-metadata">

### Author: ![Compotacustico](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/compotacustico/32/3609_2.png) [@Compotacustico](https://qa.fmod.com/u/Compotacustico)
#### Post date: [June 2, 2022, 11:03am UTC](https://qa.fmod.com/t/calling-studioeventemitter-from-code-is-always-playing-the-first-value-of-parameter-list/18830/3 "2022-06-02T11:03:04Z")

</div>

To the second:  
FMOD OBJECT: [FMOD\_OBJECT.png - Google Drive](https://drive.google.com/file/d/1wyibK4sxluKAuVtIdzPvsBFGD74klib2/view?usp=sharing)  
PARAMETER DETAILS: [PARAMETER\_DETAILS.png - Google Drive](https://drive.google.com/file/d/1bcBjF38MMgV56OnufXXfksLe1uD3TffO/view?usp=sharing)

Thanks in advance 🙂

---

<div class="post-metadata">

### Author: ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)
#### Post date: [June 8, 2022, 3:06am UTC](https://qa.fmod.com/t/calling-studioeventemitter-from-code-is-always-playing-the-first-value-of-parameter-list/18830/4 "2022-06-08T03:06:12Z")

</div>

A bit blurry, but I think the problem is from this:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/0/0b4ef84275de50fc2e88f6cf4cd152b230af37f2.png)

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.

---

<div class="post-metadata">

### Author: ![Miguel\_TA](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/miguel_ta/32/3604_2.png) [@Miguel\_TA](https://qa.fmod.com/u/Miguel_TA)
#### Post date: [June 8, 2022, 6:16am UTC](https://qa.fmod.com/t/calling-studioeventemitter-from-code-is-always-playing-the-first-value-of-parameter-list/18830/5 "2022-06-08T06:16:20Z")

</div>

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:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/4/4ebe18a765a59561d7e44301b360881bda735b75.png)

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!
