Music Looping Problem

Get help using Construct 2

Post » Sat Nov 30, 2013 2:07 am

My friend and I are making a game, and a really important part of the game is music. We've written a great deal of the songs for the game already, and all of them are written to loop flawlessly.

However, there is reverb in most of the songs, so when a song is mixed down to an .ogg, there is a couple of seconds of lingering sound at the end that plays out before the song is really "over". So the traditional 'loop song at end' isn't an option, else there would be a stupid 3 or so second delay between loops.

So I programmed a song to play on the 'start of layout' that doesn't loop, then I made another event that plays the song every 78000 ms, which is the exact duration of the song from the very beginning to the end of the last note (this doesn't include the reverb at the end).

So I expect the song to start playing instantly when the layout starts, and for the song to continue looping seamlessly afterwards.

The first loop doesn't work very well. The song starts a second time just a second or two before the first play-through of the song is finished, and it sounds really weird. Afterwards, however, the looping is just fine. Once the song is looping on the event: "autoplay every 78000 ms", the loop sounds exactly how I expected it to. So it's just the first loop that's messed up, apparently.

Note: I'm using the xAudio2 object for sound

Does the clock that counts the milliseconds not necessarily begin exactly when the "start of layout" event is run?

If anybody could tell me anything about this, or suggest a better alternative to my looping songs problem, I would be EXTREMELY grateful. Thanks in advance!
B
4
Posts: 17
Reputation: 228

Post » Sat Nov 30, 2013 2:11 am

Forget about c2 clock for precision counting. What you could do is either use delta time, or move the final reverb tail to the beginning of the track and then fade in on start of layout instead of starting straight away.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
89
S
30
G
22
Posts: 1,985
Reputation: 20,099

Post » Sat Nov 30, 2013 2:32 am

@megatronx Those are some good suggestions. I've actually considered the second before. Can you suggest a way of using the delta time function? I've not ever used, or even heard of it. How would you go about looping the music with it? Also, thanks for the help!
B
4
Posts: 17
Reputation: 228

Post » Sat Nov 30, 2013 3:01 am

You could try the Timer behaviour. It should be simpler that tracking delta-time. Also make sure the music is preloaded so you know there is no initial delay.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Sat Nov 30, 2013 3:28 am

I would think trying to time when a point in a song will happen is a bit much to ask of a browser. Even setting it to loop doesn't work everywhere.
It may work soon, it's amazing how far sound has come in the past year. But currently you may be trying to make a silk purse out of a sows ear.

Delta time compensates for slowness due to slow processors and internet lag so that timed events can skip ahead when it needs to stay lined up. But if the sound doesn't start when the timer thinks it does, you have to hope the exact same lag affects the 2nd piece too.
B
233
S
62
G
33
Posts: 902
Reputation: 40,398

Post » Sat Nov 30, 2013 3:36 am

@blackhornet I don't think I have access to the 'timer'. I will confess. I'm currently using Construct Classic...

@Paradox I was thinking this game would be more of an application that you download and play offline afterwards. Do people still do that?
B
4
Posts: 17
Reputation: 228

Post » Sat Nov 30, 2013 3:39 am

Oh Classic. That is completely different animal, I don't know enough about that to offer a suggestion.
B
233
S
62
G
33
Posts: 902
Reputation: 40,398

Post » Tue Dec 03, 2013 4:59 am

@megatronx How do you fade music? I'd like to fade it in and out between layouts (and preferably fade the layouts too).
B
4
Posts: 17
Reputation: 228


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, Euduardo, Jackriduk and 29 guests