Simulate slowdown and loss of hearing

Hello y’all! I’m a new Unity user and am looking to create 2 effects combined together in game. I would like to create a loss of hearing effect and a Slow effect at the same time on the general game audio. I would also like to have a heartbeat sound playing that would not be filtered out like the rest of the sounds. Is it possible to set transition times for the state changes? What would be the best practice to achieve these effects in Unity?

Thank you for helping out.

Stef the Sound Guy

Hi, welcome to the forum!

You can fade the sound by changing the AudioSource volume for all applicable sound effects. The slowdown can be achieved by setting the value of Time.timeScale below 1. To make the fading and slowdown gradual, you could use a coroutine to change the values over a real time interval:-

function FadeAudioSource(aud: AudioSource, startVal: float, endVal: float, interval: float) {
  var startTime = Time.realtimeSinceStartup;

  while ((Time.realtimeSinceStartup - startTime) < interval) {
    aud.volume = Mathf.Lerp(startVal, endVal, (Time.realtimeSinceStartup - startTime) / interval);
    yield;
  }
}

Can I also use the Fmod low cut filter on global sound bus at the same time???

Thanx for replying fast you are conected my friend!!! :wink:

Would this affect the pitch of the global sound bus??? As this is something I would want.

Is there a way to use the fmod effects and vector curves and apply them to a group of sounds to acheive the slowdown and loss of hearing effect?