Anders429 / simfile

Apache License 2.0
0 stars 0 forks source link

Time Signature Agnostic Charts #40

Open Anders429 opened 2 years ago

Anders429 commented 2 years ago

Modern simfile formats support time signature fields. In Stepmania, these are only allowed to have denominators of 4 or any power of 2 above 4. However, we can support any denominator value.

A denominator can be thought of as defining the length of a beat in relation to a whole note. So a denominator of 4 makes a beat the length of 1/4th of a whole note. 8 makes a beat the length of 1/8th of a whole note, and so on. So for non-dyadic values, such as 5, it just defines a beat to be 1/5th the length of a whole note.

Meanwhile, a numerator just defines how many beats there are in a measure. Technically this can be a float (2.5, for example, defines the measure as having 2 and a half beats), but I understand Stepmania only supports whole numbers. Floating point numbers can be implemented to a certain point, as long as the decimal equates to some usable fraction of a beat.

So for representing a chart with custom time signatures, I think things should be thought of in "beats" rather than in "quarter notes, eighth notes, etc". We should have a "beat" (in 4/4 time, a quarter note, but in 4/3 time a triplet note, etc), "half beats", "quarter beats", "third beats", etc. Note that the difference between 4/4 and 4/5 is not the number of beats, but the fact that 4/5 takes 4/5th the amount of time as 4/4 does, which is something that should ideally be handled by whoever consumes the chart information accordingly, although technically the bpm should change to reflect that fact.

For example, a .scc file in 5/8 time will have each eighth note read as a "beat", and there will be 5 of them stored per measure. This will be parsed the same as something in 5/4 time, since there are the same number of beats. So a measure like this:

0001
0010
0100
0010
0001,

would be parsed the same in both cases, with the only difference between the two stepcharts being the time signature's denominator.

For older formats, like .msd and .dwi, the time signature will always be 4/4. However, it should be noted that .sm technically supports the #TIMESIGNATURES tag, as although it was removed from the specification years ago, Stepmania's parser still to this day can parse the value and will use it. Oddly, the tag seems to have been reincluded in .scc despite the concerns about the tag that led to its initial removal apparently never actually having been resolved.