Forum rules - please read before posting.

sound object set to music doesnt play, crossfade between two music tracks.

Hey,
I have problem with music.
What I am trying to do - I have scene where player looks out of window, and I need music with vocals to start playing. now, player can choose anytime to stop looking and I need the music to crossfade to same song, but without vocals ( I have second instrumental version of same song )

I tried to do this with "sound/play music" but I cannot control volume of music because I need sound object to control it ( and basically needs to start playing both songs at the same time and change volume between them with action )

So, my solution was to create two sound objects, each for one music track, set them to Music, and change volume between them with action, but problem is, that my sound objects just doesnt play when sound type is set to Music.

It works when I set everything to SFX, but I need it to be music as all the music in the game is licenced.

Is there other way to do what I am trying to do?

Thanks in advance for any tips!

Comments

  • What are your AC and Unity version numbers?

    I'm not sure why there'd be a difference between setting the volume type, but it'd be better to use the dedicated music system.

    What I can do is write a function that allows you to set the samples of a music track before it's been played - so that if you then check Resume if played before? inside the Sound: Play music Action, it'll play from that point. That way, you can set the sample of the second track to match the sample of the first.

  • hey Chris,
    AC is 1.69.4 a unity is latest LTS 2017
    I tried to do it with sound objects and it works somehow - here is what I did https://imgur.com/a/0YeS9iz
    I start both at once and just change volume it works but only when its set to SFX. When I switch to music it doesnt play.

    It would be awesome to have some better solution and control it with music system.

  • Indeed. The addition I mention above will be incorporated into v1.70.

    With it, you'll be able to sync a particular track start point with the currently-playing one:

    AC.KickStarter.music.SyncTrackWithCurrent (4); // replace '4' with the track's ID
    

    What that will do is update AC's internal record of that track's resume point. If you call this just before playing this track, it should sync the two tracks together.

  • Awesome, thanks Chris.
    Btw. I actually need to use audio source to play music in other scene (there is radio playing).

    Is it intended that audio source set to music is not playing with AC?

  • Is it intended that audio source set to music is not playing with AC?

    Not at all. Before the introduction of the dedicated Music system, that was how music should be played. The 2D Demo stil uses this.

    I would need clear steps on how to reproduce this issue. From your screenshot, I wouldn't expect the "music_window" object in the middle chain to be heard because you're muting it (Action 17) immediately after playing it (Action 12) with Wait until finish? unchecked.

  • edited December 2019

    Thanks for info Chris,
    Those are actually 2 different sound objects ( music_window_vocal & music_window_instrumental ) I tested it to find out whats going on -

    In the case I sent you screenshot from - I set volume of "sound_object_a" to 1, then sound - play of "song_a" from "sound_object_a" , then set volume for "sound_object_b" to 0 and played "song_b" from "sound_object_b" - and only "song_b" with 0 intensity played - thats why it seemed it wasnt playing at all.

    It seems there is problem with playing 2 music tracks from 2 separate sound objects at the same time? If I set one of them to music and one of them to SFX it works fine, but if I set both to music, even if I disable change volume actions, only the last action in the chain is playing music - so there is always just one music track playing at the time.

    I also tried to set one music track to play by old system from sound object, and other by sound/play music and its same, only one music track is played.

    So I guess this one is maybe intended?

  • Thanks for the elaboration.

    Yes, when the Sound: Play Action is used to play music, it will turn off all other music sounds. This is intentional - or at least was prior to the introduction of the dedicated music system.

    I shall see about making this effect optional.

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.