Search Unity

Is it possible to crossfade audio using snapshots?

Discussion in 'Audio & Video' started by Chris_Randle, Jun 29, 2015.

  1. Chris_Randle

    Chris_Randle

    Joined:
    Jun 29, 2015
    Posts:
    3
    Hi guys,

    I've written some interactive music for a game and was hoping to control the crossfades between each state using snapshots. I'm having a hard time setting it up though, because there's an audible gap during each transition.

    I've tried using different curve types. The only one that doesn't produce a gap is the 'brickwall' type but (as the name implies) it removes the fade completely and sounds very jarring. It sounds like the others fade out completely before fading the new snapshot in.

    Has anyone had luck implementing this type of music system (or any other seamless crossfade between audio layers) using the snapshot feature?
     
    laurentlavigne and Menion-Leah like this.
  2. michaelhartung

    michaelhartung

    Joined:
    Dec 19, 2013
    Posts:
    72
  3. Chris_Randle

    Chris_Randle

    Joined:
    Jun 29, 2015
    Posts:
    3
    Thanks for the response. I'm not in control of the code but our coder has confirmed that we're currently using that function.
     
  4. martinmr

    martinmr

    Joined:
    Mar 25, 2015
    Posts:
    325
  5. Chris_Randle

    Chris_Randle

    Joined:
    Jun 29, 2015
    Posts:
    3
    This is the tutorial we used to implement the current system. Just to clarify, the issue isn't to do with getting snapshots to transition. We have snapshots switching, with fades in between.

    The issue is to do with them transitioning in a way that allows two streams of music to crossfade without a noticeable quiet gap during the transition.

    Normally this needs an 'equal power' crossfade. The closest to this is the 'square' fade in Unity (from what I can tell), but even this produces an audible gap. Like it fades out first, then fades the new snapshot in.

    This post touches upon it, but I wasn't sure whether he was missing a feature or whether the issue was addressed before the Unity 5 release: http://forum.unity3d.com/threads/unity-5-mixer-audio-feedback.293999/#post-1938132
     
  6. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Any luck with that?
    It seems that a proper crossfade feature is still missing, and I cannot find any related feature request.

    Honestly, I find quite weird that Unity Technologies has designed such a powerful set of tools and they lack a basic feature like that.
     
  7. wkaj

    wkaj

    Unity Technologies

    Joined:
    May 18, 2012
    Posts:
    50
    I assume you guys mean between 2 different AudioGroups.

    Transitions of volumes of AudioGroups just go from A to B. But you are asking for a transition type that will allow for constant power of volumes between 2 or more AudioGroups?
     
  8. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Yes, as Chris_Randle explained in his latest post.
     
  9. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    So @wkaj where are you at with constant power cross fade?
     
    Last edited: Aug 2, 2017
  10. Pangamini

    Pangamini

    Joined:
    Aug 8, 2012
    Posts:
    54
    Any luck?
     
  11. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    yeah I did it with some script that controlled the crossfading
     
  12. doublegumbo

    doublegumbo

    Joined:
    Oct 24, 2013
    Posts:
    53