Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Music & Sound FX / A rhythm based game, help with BPM?

Author
Message
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 21st May 2009 21:26
Lets say a song is 200 BPM, and I want each beat to go over the z-position of 0 every beat, how would I work out how fast it to move the object? I can get it in time at the start, but it goes out of time quite quickly, I am using this for the maths: (a bit pseudo-code)



help please?
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 22nd May 2009 04:56
You might try the DarkSide White Rabbit dll (link below). It has commands for beats per minute.

http://forum.thegamecreators.com/?m=forum_view&t=150335&b=18

If that doesn't do what you want, you should definitely try doing your maths with the TIMER() command rather than the frame rate. I'm willing to bet this is what's causing your problem.



prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 22nd May 2009 23:18
I have sorted it out (mostly) but the movement is really jerky, here is the pseudo code



Anymore help please? I am now using timers instead of the framerate
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 23rd May 2009 02:19
Might try using floats? Using integers can cause jerkyness when the numbers get rounded off. Otherwise, you should probably post this on the GDK board.



prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 24th May 2009 00:28
I have fixed this jerkiness, what I done is to see how many beats a second there are (200bpm = beat every 300ms), and counted until it reached the timer is equal to 300ms in this case, add added 192 to the z-position (this makes it "jump" to the next beat, and it keeps it in time perfectly.) and every frame, I use some long winded math to work out how much I move per frame. In this way, it doesn't get out of time whatsoever, due to the update every 300ms of 192, and even if the calculations for moving the cam every frame are a bit out (over the song it will add up), it "pops" it back into time. Its quite clever actually.

Thanks for the help though.
Butter fingers
18
Years of Service
User Offline
Joined: 20th Mar 2006
Location: Mecca
Posted: 29th May 2009 21:35
it's useful to get the EAP (enhanced audio plugin).

THis can return the length in bytes of a sample.

say your tune is 2 minutes long, and you cut it to ensure that the first beat falls at 0 seconds, and it's 200bpm you know that there will be:
120*200 beats in your tune. (length of track * BPM)
lets call that X

now, using EAP you can get the length of the sample. lets say thats 50000 bytes.

you can now work out 50000/X

this is how many bytes there are in 1 beat.

By doing it this way you wont have to write new code if you want to change the BPM. I recently made a music application that does just this, but as I am not the owner of the IP I cannot post it up here.

If you need any help though, drop me an email.

I want robotic legs.
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 29th May 2009 22:46
The only problem is that I'm using DGDK, but the tip is *very* useful and Ill keep it in mind ^_^


Website coming soon!!

Login to post a reply

Server time is: 2024-05-05 05:10:42
Your offset time is: 2024-05-05 05:10:42