Mod Archive Forums

Music Production => Tracking => Topic started by: Madman on February 13, 2007, 17:18:51

Title: Mod playing length
Post by: Madman on February 13, 2007, 17:18:51
Hello guys,

i would like to convert a programm i did recently for SID playback to a MOD port. But i am stuck at one thing:
How can i determine the length of a mod in seconds ?
Is there any easy way to determine it ?
I need to know the (approximate at least) time for each mod for continuos play and shuffle functions.
The offset 950 cant be everything thats related to the songlength.

Any help is appreciated.
Title: Mod playing length
Post by: Saga Musix on February 13, 2007, 19:59:41
I think that this is rather complicated. First, You have to know how fast the mod is played back. please note that there are commands which can alter them bpm and ticks per rows settings. mainly, you have to look how long every pattern is and which patterns are played back...
i hope i was able to help you :)
Title: Mod playing length
Post by: Madman on February 13, 2007, 21:26:50
Well, yes and no  :)
Isnt there any tool that can determine the songlength ?
I mean, modplug has the lenght of a mod when you load it.
My tool will be a frontend to these modplayers, but i need the total length of a mod somehow. I didnt find anything in fmod and mikmod either.  :cry:
In the HVSC we have the STIL which i use in my tool.
Is there no tool or lib or anything which i can use to determine a mods length without analyzing it fully ? Cause analyzing it fully is not an option really :-/
Title: Mod playing length
Post by: Eagle on February 14, 2007, 12:37:53
Well, you could use pen and paper and calculate yourself using the Speed and BPM values to your aid.

First, a row in speed 6 is equal to 1/16 note which 1/4 the length of a beat. Then if we have the BPM setting to 120, it will mean that 480 rows will pass in a minute. To get it as seconds, you will have to divide with 60. 480 rows/60 seconds = 8 rows/1 second

If the speed is different than 6, you can easily calculate the new BPM with this formula:
BPM*6/Current Speed

Count the amount of rows in this BPM and take in consideration of speed changes, pattern repeats and pattern break.

If there's a change of speed, just simply put the amount of rows you've calculated aside and start calculating with the new speed.

Do this until you're at the end of the song and add all your numbers together and you have the time in second. Then you can of course make them in hours:minutes:seconds with some quick calculation.

You could make a program which does this, too. It should be as simple as that.
Title: Mod playing length
Post by: pailes on March 02, 2007, 01:11:33
The best thing you can do is playing the entire module completely for one time without mixing it, it can be done in a few seconds (even less) on modern CPUs.
Title: Mod playing length
Post by: Eagle on March 02, 2007, 08:42:47
That's one good method. I use the method I mentioned above in my own tracker so I now it works (Pulse Tracker, still in development). Differences between the calculated playing time and the actual playing time is due to inaccuracies in the timing. (there are always some slight differences. In modplug Tracker, this difference is around +-1s/180s)
Title: Mod playing length
Post by: pailes on March 02, 2007, 11:42:33
MilkyTracker (which is my own tracker) does what I stated above. Differences are zero ;) (and it has the advantage that you don't need to write much additional code).
Title: Mod playing length
Post by: Eagle on March 02, 2007, 11:48:42
In my experience, MilkyTracker has a bunch of bugs when it comes to calculating the song length as it does not take into concideration pattern repeats and some loops. Whenever it encounters that, I think it stops calculating and returns a way too short song length. (Hmm, I think I should report this.)

But yes, indeed, it's a good method.

By the way, welcome to the ModArchive community forums, Pailes. Make sure you post in the introduce myself-something thread later. :)
Title: Mod playing length
Post by: pailes on March 02, 2007, 17:33:57
"Bunch of bugs", eh? ;)

Well, since MilkyTracker plays the entire song with all features to calculate the song length I really doubt this is going wrong and I have made a lot of testing to ensure it is correct. When there is no playback problem and the WAV writer writes the song correctly to the disk the song length estimation will work as well.

But I remember having fixed one single bug which caused the estimation routine to fail with an S3M I've found ("Armani Showers") but now it works correctly, maybe this is the problem you're referring to as this is still waiting for a bugfix release.

You know that there is only one pattern loop command (E6x) and not a bunch of them, don't you? (Because you were speaking of "pattern repeat" and "looping" as a different thing.