User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Beats Per Minute

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module

    Join Date
    Jul 2006
    Location
    Lacey, WA
    Posts
    756
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Beats Per Minute

    So I'm making a music application, and I'm trying to calculate how to get an Every X.X Second(s) do blah action from a user inputted Beats Per Minute... does that make sense? So if he inputs 60, it would be every 1 second, or 120 BPM would be every .5 seconds, 30 would be every 2, etc... and my head is not working with math at the moment, so what would this calculation be? And how can I get it as accurate as possible in game (since it does have to sync to the proper exact BPM)?

    Is there something out there that does PERFECT timing like this (such as a "double precision timer" :P )?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export Module

    Join Date
    Jun 2006
    Location
    Derby, United Kingdom
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Beats Per Minute

    60/your input

    60/120=0.5
    60/60=1

    etc...

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module

    Join Date
    Jul 2006
    Location
    Lacey, WA
    Posts
    756
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Beats Per Minute

    ^^^Yes, but the only problem with that is when I say "Every [calculation] Seconds" (Using the timer object or what-have-you) it gets very close, but isn't perfectly accurate, probably because the decimal place only goes to like 5-6 or something and rounds the number (right?). Is there any timer-like extension that is made for perfect time calculations?

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Beats Per Minute

    Use the Time X Object (I think this can be found in the z33z Ext. Pack on the sidebar) and add an "Every...". Enter the expression:

    (60.0/Your Input)*1000

    Hope that helps.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module

    Join Date
    Jul 2006
    Location
    Lacey, WA
    Posts
    756
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Beats Per Minute

    I tried that, but the only problem is that MMF only goes to 6 decimal places. I thought maybe the Double Precision Calculator would fix this, but I have to convert it to a number value after the calculation and it goes back to 6 decimal places anyway. It doesn't sound like it would make that big of a difference, but when I try to sync it up to another sound program (Fruity Loops), it becomes slightly more and more off beat over time.

    Would there be a way to make it time the beats perfectly? Or at least compensate for the imperfection?

  6. #6
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    1,812
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Beats Per Minute

    ...why would you want more than 6 decimals. Normal BPMs only have like 2-3.

  7. #7
    Clicker Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    MTCMusic's Avatar
    Join Date
    Jan 2007
    Location
    Montreal, Canada
    Posts
    364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Beats Per Minute

    I had a similar problem when i was trying to create a virtual metronome. Someone had told me that it has to do with the level of the program interpreter. If the code compiled in a low level language, there will be virtualy no delay in accessing the sound hardware and getting precise timing (like Frootyloops). but the code compiled with MMF has to be interpreted by windows to activate the sound hardware and this causes the slight timing problems when trying to work with precise BPMs. I'm not sure if this is explained correctly, but this is the reasoning a programmer friend of mine gave me.

  8. #8
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Beats Per Minute

    In MMF your best accuracy is going to be 1/fps, with possibly some delay on beginning to play the sound.
    In another language you could manage the sound buffer yourself and add the "beat" to the buffer with some silence before it to get perfect timing.
    Can you change the playback speed in MMF? The easiest way might be to make a 1 second long sound with one beat in it, play it looping at whatever speed you need.

  9. #9
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, ┼rhus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Beats Per Minute

    Yes, time+floats tends to go a little off all the time. If you are able to have the exact length of a beat in a float, then there is a way that doesn't make bigger and bigger errors over time.

    Heres some pseudo-code:

    Code:
    if TIME is greater or equal to NEXT_BEAT
         You have a beat! 
         NEXT_BEAT = NEXT_BEAT + TIME_BETWEEN_BEATS
    Note that the TIME variable has to be some very precise timer. I don't think MMF2's timer is precise enough, but there are a few extensions that might be of use. This *should* never go out of sync.

    Also, if it is critical that your sounds are very precise then you should raise the FPS from 50 to something around 100 or more.

    If you leave MMF2's FPS at 50 you can in the worst case get a delay in the sound for up to 1/50th of a second. If you raise it to 100 the max delay will be around 1/100th of a second.

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module

    Join Date
    Jul 2006
    Location
    Lacey, WA
    Posts
    756
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Beats Per Minute

    This works just about perfectly! I left it on for 30 minutes in sync with Fruity Loops and it stayed in sync! After about 2 hours, though, it started getting a little out of sync, but really this tiny tiny bit doesn't matter for what I am doing. Thank you so much!

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Synchronizing events to Beats Per Minute?
    By JayTholen in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 4th April 2012, 01:59 AM
  2. a few last minute questions
    By willow in forum SWF/Flash Export Module Version 2.0
    Replies: 3
    Last Post: 1st April 2011, 08:59 PM
  3. Request: Beats Per Minute extension
    By Bipolar_Games in forum Extension Development
    Replies: 6
    Last Post: 14th December 2010, 08:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •