How do I sync a sound to a division of a musical beat?

Get help using Construct 2

Post » Tue Aug 23, 2016 8:18 am

@blackhornet Here's my example, it's buggy is the browser is a bit low on memory, probably because I'm using visual cues as references, and the fx buttons sometimes "short out" the samples: https://www.dropbox.com/s/3cdl7txdqhizm ... .capx?dl=0

Any ideas how to improve this a bit? :D
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Wed Aug 24, 2016 5:12 am

It's hard to know where to start. You don't need clones of the same button, to start. Multiple instances of the same button would make things much simpler. You would use instance variables to store anything unique to that button, and use the same code to do all the same things, just with the various instance variables.

Event 2 should be inside the "On start of layout" - it's creating 8 BeatSprites every tick!

I see what you are trying to do now. You've got your work cut out for you. You are going to have to calculate the bpm of the samples you already have and try to sync them all together. That's going to take some work, and a good understanding of the math.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Wed Aug 24, 2016 10:16 am

blackhornet wrote:It's hard to know where to start. You don't need clones of the same button, to start. Multiple instances of the same button would make things much simpler. You would use instance variables to store anything unique to that button, and use the same code to do all the same things, just with the various instance variables.

Event 2 should be inside the "On start of layout" - it's creating 8 BeatSprites every tick!

I see what you are trying to do now. You've got your work cut out for you. You are going to have to calculate the bpm of the samples you already have and try to sync them all together. That's going to take some work, and a good understanding of the math.


@blackhornet
Okay, I probably could used more efficient sprite reusage, but I have calculated the samples and they do sync most of the time (have you pressed start then clicked a sample button?) but the issue is they don't trigger accurately if the users browser isn't running at full speed. I'll fix that Sprite respawn issue! Could I tighten your triggering code to work more on the code side rather than relying on the visual cues?
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Thu Aug 25, 2016 7:15 pm

You are reading the "0" out of the text object, so just look where the value is set and check for zero there instead. Call a function there and process whether or not to run the loop. The timer should deal with any dt discrepancies, but if you find it doesn't, you could look at tracking the "Audio->On ended" trigger of your main timing sample and use that as your sync point instead. You are going to have to experiment with how to sync everything together.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests