Forum rules - please read before posting.

Issue crossfading ambience tracks

edited July 2020 in Technical Q&A

I have two ambience tracks, night_ambience and morning_ambience, which are 30s long each. At night, night_ambience is set to loop until the game clock reaches 6am - then I trigger an actionlist that is supposed to crossfade morning_ambience in over 10 seconds.

The problem is that this doesn't always work. These are my observations (please correct me if I'm wrong):

If "Queue?" is unchecked, and the actionlist is triggered when night_ambience is anywhere between :00 and :20, the crossfade starts immediately and goes smoothly.

If "Queue?" is checked and the actionlist is triggered when night_ambience is anywhere between :00 and :20, the crossfade starts at 00:20 and goes smoothly.

Whether "Queue?" is checked or unchecked, and the actionlist is triggered when night_ambience is anywhere between :21 and :30, the crossfade starts immediately and goes smoothly only until night_ambience reaches :30. Then night_ambience drops off abruptly. The closer to :30 the actionlist was triggered, the more abrupt it sounds.

I imagine this happens because when a crossfade starts, night_ambience is instructed to stop looping. To fix the problem, it'd have to be instructed to stop looping only after its volume was crossfaded to 0.

Also, I haven't tested this with music tracks, but I'm assuming the behaviour would be the same?

Comments

  • ^ That was the main issue. Another minor issue I found was that if in the middle of a crossfade between tracks #1 and #2, you start a crossfade into track #3, #1 is dropped immediately, and the crossfade happens between track #2 and #3. It would be nice if both track #1 and #2 slowly faded out instead.

    A real-life example of this usage would be if my scene contained an outdoor and an indoor location, and I crossfaded ambience_night_indoor and ambience_night_outdoor whenever the character entered or left a house. If they entered the house during the transition from night to morning, it would sound glitchy.

  • edited July 2020

    Currently, only one crossfading effect is possible at a time.

    Thanks for the bug report - both music and ambience rely on the same system, so likely music has this issue as well.

    I'll look into this and let you know if I need more details.

  • Recreated. If you open up MusicCrossfade.cs, look for the FadeOut function at the bottom. In the middle of it, insert the following:

    _audioSource.loop = audioSourceToCopy.loop;
    

    Does that reolves it?

    On the second issue (multiple crossfading effects), I will look into enabling this in the next release.

  • It does, thank you! Now fading out works no matter where in the loop it starts.

    Also thanks for looking into enabling it, that would be great.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.