Why is my audio volume mysteriously increasing?

I’ve recreated this issue with a new, simple scene:

  • GameObject1 has a looping sound of quiet ambient noise.
  • GameObject2 has a script that fires audio.PlayOneShot(myAudioClip) when I press a key

This seems to work fine at first: I hear the looping ambient sound from GameObject1, and whenever I press a key, GameObject2 plays myAudioClip. But each time myAudioClip on GameObject2 fires, the ambient sound on GameObject1 gets a little bit louder. After several dozen keypresses, the ambient sound is quite loud.

Why would it do this??

[UPDATE] I can reproduce this even more simply: Just place a short audio clip on an Audio Source component and set it to Loop. Run the game, and it will get progressively louder with each loop. Wtf? Can anyone else recreate this?

I have created the scene that you have described. Two GameObjects, with both an AudioSource component, one AudioSource containing an AudioClip which loops, the other AudioSource is used through a script that does audio.PlayOneShot(myAudioClip) on GetKeyDown.

I have a long constant noise looping, and a short sound as myAudioClip which I can trigger when I press “s”.

I have attached a script to the Main Camera that monitors the levels of audio passing through the AudioListener, which is converted to dBFS and shows on the screen.

When the noise is looping, it settles in at about 30-33 dBFS. When I press “s” a couple of times, and trigger myAudioClip to be played, the volume spikes. But, from what I’ve observed, always settle back to about 30-33 dBFS.

Here’s my project in a .zip: (Google Drive, 83MB because of a 42MB .wav, sorry :P)

You could attach the script called mydBFSPlayerPerspective to the object in your project that holds the AudioListener, input a value at myWindowSize, I used 512 in my project, and monitor the audio levels in yours.

I’m curious to find out what values you’ll see!

Welp, it looks like it’s something stupid w my machine. I can recreate this weirdness at will on my iMac, but not on my Mac Book Pro. Exact same project files. Whatev.