vgm bpm guesser

Discussion in 'Utilities Archive' started by nineko, Feb 8, 2013.

Thread Status:
Not open for further replies.
  1. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    Sometimes you listen to a vgm file and you wonder what tempo it uses, for various reasons, for example you want to do a vgm2mid conversion that would align the beats to the measures instead of using the default 120 bpm.


    I am writing a program that can help with that, in some cases. It looks for the delay commands in vgm files to guess the tempo, starting from the idea that a delay between two beats (or beat multiples / submultiples) should occur often in the file. Of course this isn't always true, since delays can also be between other commands (e.g. pitch bends, volume slides, other non-note things). Also, most of the vgm files on smspower have been ripped with "frame accuracy", effectively using only 735 or 882 samples as delays, making it impossible to guess anything. Still, it's an idea, and it didn't take me much time to work on this, so yeah here it is.


    Let's paste the template:


    Tool Name: vgmagic


    Build: 0.01


    OS: Windows 95 or better. Requires msvbvm50.dll.


    Author(s): nineko


    Description: counts the delays in a vgm file, trying to guess the bpm.


    Download: here (RAR file, 7300 bytes).


    Now, how to use it.

    [​IMG]


    Enter the filename of a vgm file and click on "Do it!"


    This will populate the list on the right with all the delays used in the file, and it will also draw a graph with the default settings.

    [​IMG]


    From there, you can change the range of the graph by entering other values by hand in the two textboxes, so you can focus on a specific range. Click on "Redraw" to redraw the graph, obviously.

    [​IMG]


    Once you restricted the graph to the range of your interest, you can click on "Try" to calculate the average of the values displayed in the graph.

    [​IMG]


    This isn't an exact science. The actual tempo of the song in the example is 225 bpm; seeing 450 amongst the results still makes me happy, as that's a multiple.


    Unsupported features:

    • vgz files. Decompress them with vgmtool or something. Support for vgz files is NOT on the to-do list.
    • most v1.50 vgm files, all v1.51 vgm files and above, and basically every vgm file that uses PCM tables. This MIGHT be on the to-do list, maybe, eventually.
     
    Last edited by a moderator: Feb 8, 2013
  2. GT Koopa

    GT Koopa Well-Known Member Member

    Joined:
    Mar 9, 2011
    Messages:
    83
    Location:
    Elgin. IL
    This is something that I always wanted. Better for editing and making remixes with I assume?
     
  3. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    In a nutshell.


    Say you have a vgm that uses a tempo of 90 bpm, which means 0.666 seconds between each beat.


    You don't know the bpm of that vgm, but you want to use vgm2mid on it. The resulting midi file, by default, will use a tempo of 120 bpm (0.5 seconds between each beat). Now, here's what happens (assuming a midi resolution of 480 ticks per beat):


    Time, measure:beat.tick, vgm


    0.000, 1:01.000, beat 1 -> ok


    0.500, 1:02.000, nothing -> not ok


    0.666, 1:02.160, beat 2 -> not ok


    1.000, 1:03.000, nothing -> not ok


    1.333, 1:03.320, beat 3 -> not ok


    1.500, 1:04.000, nothing -> not ok


    2.000, 2:01.000, beat 4 -> oh God we drifted away by an entire beat by now D:


    And this is a simple example with a simple value such as 90 bpm, just imagine how horrible the timing in the midi would be with odd numbers and whatnot (it's the same problem the old S&KC rips had, for the record). The midi file would still be listenable (which is why almost nobody complained that the S&KC rips were wrong), but it will look very bad if you open it in a midi editor or something (which is why most musicians were happy when I released the perfect S&KC rip).


    Of course there are many other ways to guess the tempo of something, Winamp even had a plugin for that, and there are programs that guess the tempo simply by tapping the spacebar on your keyboard (even I wrote one of those several years ago), this is just a more technical approach which might or might not give better results.
     
    Last edited by a moderator: Feb 9, 2013
Thread Status:
Not open for further replies.