Volume increases if 2 audio clips play at the same time

I have my collision sound files in WAV format. I have set up the volume for all the sounds in Audio Source. I play the sound file using AudioClip.PlayOneShot(). It works fine for single sound at a time. However, if there are multiple collisions at the same time, PlayOneShot() is called simultaneously for all the collisions resulting in a louder sound.

Why is the resulting sound of simultaneous play calls louder? It might be that its an illusion of louder sound because the multiple sounds are separated by a very small interval in milliseconds, but it does sound louder in volume.

I can code it in a manner that the play sound function gets called only once if the successive function calls are too close to eachother, but it would be a hack. Is there a better solution to tackle this?

Thanks,
Mukul

1 Like

I’m a noob at this but it must be coming from the same audio source. You can only play one sound per audio source. Incidentally I’m learning this all just today so the answers here should be helpful.

Because you’re essentially playing multiple instances of your collision sample at the same time. The audio signals will be summed. In your case, playing two identical samples at the same time will result in the sample played twice as loud.

What’s the reason that you don’t want two collisions to be louder than one? In the real world that would be the case. Two impacts should really be louder than one. Having said that, I understand that this can sound quite jarring and unconvincing sometimes. Naturally, it depends on your game’s needs, but a few things that helped me when having many potentially simultaneous sound effects:

  • Try using a few variations of the sound. Playing two identical samples very close together can be quite jarring. If you had say 5 collision sounds and ‘randomly’ select one each time your trigger a collision (never the same one twice in a row), it would help to create a more convincing solution.

  • Mix your levels in-game. This sounds obvious, but test and balance your levels in-game. You’ll quickly discover that you have for example, 3 simultaneous collisions happening when you expected one, and so that sound effect needs to come down in volume. Again, 3 impacts probably should be louder than one.

  • Enforce some limits. You mentioned it was a hack but I think it’s sensible to enforce some limits. There comes a point whereby it becomes hard to differentiate between say 4 simultaneous impact sounds and 5, and you’re really just risking clipping/distortion and wasting CPU. It depends on your system, but you could even have separate sound effects for high numbers of collisions. A good example of this is in Wii bowling when you knock over large numbers of pins, a separate many-pins-falling-down sound effect is used as opposed to when you knock over two or three and it plays one for each pin.

Hope that helps a bit!
Andy

1 Like

I realize this is an old thread but for posterity: All of my distortion went away when I added all of the audio sources to an “AudioMixerGroup” and then added the “normalize” effect with default options. It did effectively exactly what I think you wanted it to do.

18 Likes

This!

This is fantastic thank you :wink:

This is an old thread but just wanted to add in what I found since this thread always comes up when I search for loud volume when playing multiple oneshots.

The normalize option mentioned above did not affect my sounds when playing two or more of them at the same time (multiple enemies being hit by the same attack, multiple enemies dying at the same time, etc). I found a blog post talking about adding a “Duck Volume” effect to my master mixer, and setting up a “Send” effect from my soundfx channel to my master channel. The trick is to then drop your sidechain mix down to 0% and voila my multiple PlayOneShots don’t sound crazy loud when more than one triggers.

4 Likes