Hello! Welcome to my coolest asset yet!
BPM - The Music Synchronization Machine
Many of us wanted to synchronize the music to the things that happens in our games. Let's say things like moving the sprite of the character to the beat of the song, or making strobe light synchronized, let alone make games like the fantastic Crypt of the Necrodancer. Well, this asset should make your life much easier. Now, all you need to do is input the BPM of the song and the time signature. That is ALL. The code will synchronize a metronome and it will handle all the beats. Then it will send signal to custom events for each beat of the measure and you can customize it like you want!
Not only that, but, to show a little bit of what this thing can do, I made a demo room which contains things like sprites changing their colours with each beat, strobe lights on major beats, balls that jump on time with the music, and most of all: A character that you can move but it will only move synchronized with the music. Is just a set of arrows as a proof of concept, but the possibilities with this are endless!
How does it work? First, we start with a metronome object. With some equations and accounting the delta_time of each PC as well as the frames, it runs a timer against a threshold that's constantly raising on each beat. Then, when it register a beat, it checks whether is the first beat of the measure or any other (easy to change this) and runs an event on a separate object (so it doesn't interfere with the bpm step event). That object, called an activator or event handler, runs whatever you want every time it receives an activation by the metronome.
But is it accurate? Given that the games normally refresh at a rate of 60 times per second, this things normally aren't that accurate. But the way I programmed is simple yet effective, and any margin of error that could case some milliseconds of delay on a beat are fixed on the next one, thus making it always synchronized. That's why I've put the demo song. Just check it for yourself!
Is it compatible with X device? Yes it is! It doesn't use any DLL or code outside plain ol' GML.
Is it slowdown proof? The code is fast enough (I've even included a start_metronome_fast() version of the script) but it should be slowdown proof, because the code also takes into account the delta_time.
Is there a demo to see this working? Yes it is, download this here!
If you like this asset, you can check the rest of my assets, including my Echo/delay effect for GMS2. You can also follow me here!
If you have any doubt or want to contact me about something, feel free to send me an email to firstname.lastname@example.org
Bye for now! <3
1.0.0: Initial release.
Version 1.0.0. Published February 27, 2019
This asset hasn't received enough reviews yet.
You can only review assets you've bought.
No reviews have been left for this asset - be the first!