Search Unity

Audio Reverb tail gets cut off when changing any audio source parameter

Discussion in 'Audio & Video' started by ReaktorDave, Aug 28, 2021.

  1. ReaktorDave

    ReaktorDave

    Joined:
    May 8, 2014
    Posts:
    139
    When playing back an audio clip through an audio source and having an "Audio Reverb Filter" component placed below that audio source, changing any parameter on the audio source will result in the reverb's tail being cut off. The most obvious parameter to change is "Stereo Pan" - funnily it works even when the source is in 3D mode, where "Stereo Pan" is supposed to have no effect at all on the sound.

    This happens in Unity 2021.1.18, 2020.3.16 and 2019.4.29 and it can also be observed when using the "Audio Chorus Effect", though it's a bit more fiddly to make the issue very clearly perceivable.

    On a technical level, it sounds to me like any change on the audio source's parameter (pitch, volume, stereo pan, spatial blend were tested) causes the wet buffers of any following audio effect components to be reset. On the reverb, you'll clearly hear the tail being cut off. On the chorus, you'll hear how the usually continuous beating restarts. Any active echos from the echo filter component will be deleted. This happens every UI frame update the parameter is being changed, which can lead to some strange robotic artifacts on the chorus and to the spatial impression of the reverb and echo are being completely destroyed.

    Can you confirm this behavior? Is it for some reason intended or is it a bug?
     
    Last edited: Aug 28, 2021
  2. ReaktorDave

    ReaktorDave

    Joined:
    May 8, 2014
    Posts:
    139
    This issue occurs when changing the AudioSource's parameters via the Inspector GUI or via an Animator.

    Everything sounds fine when changing the parameters via code.
     
  3. janm_unity3d

    janm_unity3d

    Unity Technologies

    Joined:
    Jun 12, 2012
    Posts:
    36
    Hi ReaktorDave, thanks for reporting this, it's indeed a bug, and related to this we also found issues related to reordering of audio filters at runtime in the inspector. A fix is on the way.
     
    ReaktorDave likes this.
  4. ReaktorDave

    ReaktorDave

    Joined:
    May 8, 2014
    Posts:
    139
    Thanks a lot!

    How is reordering of filters at runtime possible? The Unity API doesn't support reordering components through Player-only APIs. There's just an internal, editor-only API that allows this.

    It would be great if it was possible to reorder Audio Filter components at runtime with an API that's supported in a build. Currently, all I can do to change the order is destroying and re-adding the components in the new order, which has some CPU overhead.
     
  5. janm_unity3d

    janm_unity3d

    Unity Technologies

    Joined:
    Jun 12, 2012
    Posts:
    36
    You're right, there are no APIs for changing the order of the components as such other than the way you described. What I meant was moving the audio filter components in the editor in playmode.