Seamless Transition Between Audio Files

Get help using Construct 2

Post » Wed Feb 10, 2016 1:21 pm

Hey all! So I've created a small "music maker" that lets you combine loops to create a song, but the transition isn't fluid. Sometimes it goes to the next file too fast, other times there's a small break between loops.

Here's the program/game: http://www.newgrounds.com/portal/view/670185

This is what I used for making the song move forward. I had a blank audio file that's the same size as the other audio files to gauge when to move forward:

Image

Any help is appreciated. Thanks!
B
8
S
3
Posts: 48
Reputation: 1,013

Post » Thu Feb 11, 2016 1:18 pm

Lost cause, eh? Darn.
B
8
S
3
Posts: 48
Reputation: 1,013

Post » Sat Feb 13, 2016 1:16 pm

There might be a solution where I play all of the audio files looping and muted, but I unmute the tracks that are meant to actually be playing. This would take up a lot of events, so I'm wondering if there's an easier way?
B
8
S
3
Posts: 48
Reputation: 1,013

Post » Mon Feb 15, 2016 3:19 pm

Bump. Guyyyys, I'm really at a loss here.
B
8
S
3
Posts: 48
Reputation: 1,013

Post » Sat Feb 20, 2016 8:02 pm

Bump. Pls ;-;
B
8
S
3
Posts: 48
Reputation: 1,013

Post » Sat Feb 20, 2016 8:38 pm

I have no experience with timing of sounds so this is all a complete guesswork, but did you do the timing with the overlapping the pattern with your seekbar? I wouldn't do something what needs a exact timing with a collision or overlapping event.
I would put the pattern in an array and use the array to play the sounds in the correct order.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Thu Feb 25, 2016 10:24 pm

Asmodean wrote:I have no experience with timing of sounds so this is all a complete guesswork, but did you do the timing with the overlapping the pattern with your seekbar? I wouldn't do something what needs a exact timing with a collision or overlapping event.
I would put the pattern in an array and use the array to play the sounds in the correct order.


Sorry for the late reply; this week's been nuts. I'll definitely try that! I'm not a big fan of arrays, but today's a good day to learn :D
B
8
S
3
Posts: 48
Reputation: 1,013

Post » Mon Mar 21, 2016 1:40 am

Asmodean wrote:I have no experience with timing of sounds so this is all a complete guesswork, but did you do the timing with the overlapping the pattern with your seekbar? I wouldn't do something what needs a exact timing with a collision or overlapping event.
I would put the pattern in an array and use the array to play the sounds in the correct order.


Okay, so the overlapping isn't the problem. I tried using a function that loops itself every 6.621 seconds (the EXACT timing of all of the loops), but there's still a timing issue. This is what the function looked like

Image

And since I'm getting desperate, here's the capx: https://www.mediafire.com/?nrdsqhvdd45b0mg Please don't use it for anything more than helping me :X
B
8
S
3
Posts: 48
Reputation: 1,013

Post » Mon Mar 21, 2016 5:37 am

Okay, I do this type of transition work in my game currently and it works great. Admittedly, I saw this post really late at night and I really need to go to sleep. Tomorrow I'll screenshot some of my events and show you a little of how it's done, but a few hints until then:

Do not use Wait or any other system thing for timing. This will more times than not be at least a tiny bit off from the actual audio files in use and, as I'm sure you've noticed, tiny differences make for a big problem with audio. Instead, you should use Audio.PlaybackTime(Tag) for everything. Then, you can use Audio>Seek to for lining up your tracks. Remember, though, if you're looping a track, the PlaybackTime will keep going past the looppoint (ie, it'll count past the end of the audio file) so you'll also need to seek your guide track back to 0. Lastly, you need to recognize that the events aren't going to be absolutely accurate, but you should use correct values. So if your loops is 6.345 seconds, you should run your events when PlaybackTime is > or = to 6.345.

And, lastly, if someone sees this and is curious about how to find the most accurate timing for stuff, here's a good formula for it. If your measures are at a strict tempo, it's BeatsPerMinute/60*BeatsPerMeasure. So 144/60*4 would be 144 bpm in 4/4 time. Then, you can multiply that number by however many measures are in your track to get the loop length.

So when I get a chance tomorrow, I'll walk you through a bit more of this in greater detail with screenshots (and probably an example).
B
103
S
38
G
19
Posts: 962
Reputation: 17,986

Post » Mon Mar 21, 2016 10:23 pm

C-7 wrote:Instead, you should use Audio.PlaybackTime(Tag) for everything.


Oh man, how did I never think of that?

Fixed my capx to include that, but something's not registering with the event. If I do if Audio.PlaybackTime("blank") >= 6.62 (in debug, the time is rounded to 6.62), it'll stop on the first bar and not play any of the other ones.

I set it to 6.6, which almost does the trick, but it's still iffy. Also, sometimes in the debug I'll pause it and the times for a few of the tracks aren't the same as the rest (off by like 0.01 or 0.02, but noticeable).

Updated capx: https://www.mediafire.com/?qy02hu2y52x2b3n

Image
B
8
S
3
Posts: 48
Reputation: 1,013

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 6 guests