Seamless Transition Between Audio Files

Get help using Construct 2

Post » Wed Mar 23, 2016 2:20 pm

Image

For me, I typically just have each of my tracks "complete" instead of piecing layers together--so I switch between fully mixed versions. The only difference is at times adding maybe one element like a melody over top. A couple of those earlier events refer to the adaptive music parts that I use, so ignore those, but that's the gist of how I do it all. The business with arrays is all for my own convenience and re-use of events, so you don't have to worry about that.

Despite the tracks being set to loop, I still re-seek them to the beginning to reset the playback time (otherwise it keeps going up). And, with how I have it set up, I just call a simple function in-game and this code will take care of it all. The adaptive stuff is much more complex, but I can still control it all with one simple function call. So once the initial setup is done, be sure to make it easy for yourself to control it all!
B
100
S
36
G
16
Posts: 947
Reputation: 16,219

Post » Wed Mar 23, 2016 2:58 pm

B
100
S
36
G
16
Posts: 947
Reputation: 16,219

Post » Wed Mar 23, 2016 3:36 pm


yeah but Chrome and Firefox still won't sync tracks without manually aligning them... and when you manually align them after each loop it creates artifacts.. so still no seamless transitions with multitracks...

like in my example from 2 years ago... (you have to let it loop 5-6 times then you hear it go way out)

audio-syncing-a-limitation-or-bug_t98383
B
75
S
26
G
14
Posts: 1,091
Reputation: 14,204

Post » Wed Mar 23, 2016 5:17 pm

jobel wrote:

yeah but Chrome and Firefox still won't sync tracks without manually aligning them... and when you manually align them after each loop it creates artifacts.. so still no seamless transitions with multitracks...

like in my example from 2 years ago... (you have to let it loop 5-6 times then you hear it go way out)

audio-syncing-a-limitation-or-bug_t98383


That was a quick and dirty example, but the trick would be to align the track while it's silent just before you fade it in. If you're only trying to have one or two tracks actually fully audible at a time, this should be no problem. The problem would come from trying to continuously line up a whole bunch of tracks simultaneously while they're playing. I didn't put in the check in the screenshot I posted above, but right before you fade a track in, sync it to what is currently playing. Then it will fade in correctly and you have no reason that de-syncing would even be audible.

Your idea of a silent 'guide' track is actually a really good idea and a great way to make this all work perfectly.
B
100
S
36
G
16
Posts: 947
Reputation: 16,219

Post » Wed Mar 23, 2016 5:58 pm

C-7 wrote:but right before you fade a track in, sync it to what is currently playing. Then it will fade in correctly and you have no reason that de-syncing would even be audible.


this gets tricky if you use "stems" though.. I think you mentioned you were using full mixes. I'm talking about making 1 piece of music 2 minutes long and I break it out into 4 tracks that need to be played simultaneously. So "virtual remixing" basically.. Once you have more than 1 track playing you can't re-seek those without causing audio junk that you will hear.

I just assumed this was beyond the scope of what C2 can handle. It would be tricky enough to code it without these sync issues.. with sync issues it's not really worth the effort unless your game is dependent on the music.
B
75
S
26
G
14
Posts: 1,091
Reputation: 14,204

Post » Wed Mar 23, 2016 6:26 pm

jobel wrote:
C-7 wrote:but right before you fade a track in, sync it to what is currently playing. Then it will fade in correctly and you have no reason that de-syncing would even be audible.


this gets tricky if you use "stems" though.. I think you mentioned you were using full mixes. I'm talking about making 1 piece of music 2 minutes long and I break it out into 4 tracks that need to be played simultaneously. So "virtual remixing" basically.. Once you have more than 1 track playing you can't re-seek those without causing audio junk that you will hear.

I just assumed this was beyond the scope of what C2 can handle. It would be tricky enough to code it without these sync issues.. with sync issues it's not really worth the effort unless your game is dependent on the music.


I just always assumed timing would be an issue from the start because of cpu variance, so I opted from the beginning to just have multiple versions of loopable tracks instead of relying on mixing in-engine. It isn't an issue for adaptive pieces that procedurally choose the next measure to play, but for crossfades I opted to not even worry about syncing issues and instead just mix the versions I wanted ahead of time.
B
100
S
36
G
16
Posts: 947
Reputation: 16,219

Post » Wed Mar 23, 2016 7:02 pm

C-7 wrote:I just always assumed timing would be an issue from the start because of cpu variance, so I opted from the beginning to just have multiple versions of loopable tracks instead of relying on mixing in-engine.

it's actually not hard to do at all... the capability is there. it would most likely be a minor change to have the audio sync. I just don't think the devs working on Chromium quite understand why it's important. In fact, I don't think many people period understand why it's important.

A composer and create a 2 minute track, export it out into 4 parts. In-game you can dynamically change the mix and can create an adaptive audio system that reacts to game triggers OR flat-out create a random re-mix making your 2 minute track sound "not looped" as in: it changes enough times it sounds like a track 10-15 mins long.

EDIT: separate the drums and a the synth pad... mute the drums when you are in a dark alley, when a monster jumps out and starts chasing you, fade in the drums... viola.. epicness ensues...
B
75
S
26
G
14
Posts: 1,091
Reputation: 14,204

Previous

Return to How do I....?

Who is online

Users browsing this forum: celstrider, cgsammu, Google [Bot], justifun, LaurenceBedford, Magistross, varr and 12 guests