Is it possible to crossfade audio using snapshots?

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?

2 Likes

I don’t know how you transition at the moment, but have you tried using the AudioMixerSnapshot.TransitionTo() function [1]? I think this should do the trick!

[1] Unity - Scripting API: Audio.AudioMixerSnapshot.TransitionTo

Thanks for the response. I’m not in control of the code but our coder has confirmed that we’re currently using that function.

If it’s still necessary for you or others:

https://unity3d.com/learn/tutorials/modules/beginner/5-pre-order-beta/audiomixer-snapshots

at 1:15

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: Unity 5 Mixer/Audio feedback - Unity Engine - Unity Discussions

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.

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?

Yes, as Chris_Randle explained in his latest post.

So @wkaj where are you at with constant power cross fade?

3 Likes

Any luck?

yeah I did it with some script that controlled the crossfading

Any news re: a roadmap to implementing this in the audio engine? I found this but it seems like a workaround to something that should be in the feature set. (check Tip 10)