# How to limit sound volume of the same event that plays multiple instances at the time?

**URL:** https://qa.fmod.com/t/how-to-limit-sound-volume-of-the-same-event-that-plays-multiple-instances-at-the-time/21440
**Category:** Unity
**Tags:** unity
**Created:** [April 2, 2024, 7:04pm UTC](https://qa.fmod.com/t/how-to-limit-sound-volume-of-the-same-event-that-plays-multiple-instances-at-the-time/21440 "2024-04-02T19:04:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tinytouchtales](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/tinytouchtales/32/2584_2.png) [@tinytouchtales](https://qa.fmod.com/u/tinytouchtales)
#### Post date: [April 2, 2024, 7:04pm UTC](https://qa.fmod.com/t/how-to-limit-sound-volume-of-the-same-event-that-plays-multiple-instances-at-the-time/21440/1 "2024-04-02T19:04:46Z")

</div>

Hi, consider the following setup:

Top down game with hexboard and Camera above. I spawn multiple fires during gameplay on the game board and instance my fireLoop event on their positions. The more fires I spawn the louder they get playing simultaneously.

How do I limit the overall volume of all my playing fire loops to a max. volume?  
I can’t limit the playing instances because I need all fires to emit sound.

I tried to add a bus group and only route the fire loop event to it and then adding a Limiter Effect, but that did not change the volume of my loops.

Thanks!

---

<div class="post-metadata">

### Author: ![tinytouchtales](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/tinytouchtales/32/2584_2.png) [@tinytouchtales](https://qa.fmod.com/u/tinytouchtales)
#### Post date: [April 3, 2024, 7:57am UTC](https://qa.fmod.com/t/how-to-limit-sound-volume-of-the-same-event-that-plays-multiple-instances-at-the-time/21440/2 "2024-04-03T07:57:41Z")

</div>

I sort of answered my own questions.  
My solution, adjust the fire bus with the amount of fires via code.

```auto
 private void UpdateVolume()
    {
        if (currentSoundsPlaying <= maxSounds)
        {
            SetBusVolume(1.0f); // Keep volume at max if within limit
        }
        else
        {
            int extraSounds = currentSoundsPlaying - maxSounds;
            float volumeReduction = extraSounds * decreaseFactor;
            float newVolume = Mathf.Clamp(1.0f - volumeReduction, 0, 1.0f); // Ensure volume is between 0 and 1
            SetBusVolume(newVolume);
        }
    }

```

---

<div class="post-metadata">

### Author: ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)
#### Post date: [April 8, 2024, 5:53am UTC](https://qa.fmod.com/t/how-to-limit-sound-volume-of-the-same-event-that-plays-multiple-instances-at-the-time/21440/3 "2024-04-08T05:53:52Z")

</div>

I’m glad to hear you were able to resolve your issue.
