logicomacorp / WaveSabre

Official WaveSabre repository
MIT License
245 stars 33 forks source link

Consider more consistent and precise time handling in converter/song #101

Open yupferris opened 1 year ago

yupferris commented 1 year ago

So far we've been a bit sloppy and sometimes use samples and sometimes seconds, whichever is convenient. However, this leads to tiny differences due to imprecision when we change code sometimes, and even though these differences are neglible from a musical perspective, it's still a source of unpredictability and a nuisance when running/updating tests.

Since we're working with musical data, times could probably be expressed in terms of something more musical. Off the top of my head, a bar_index: uint, time_offset: rational_notes pair is probably sufficient and not prone to rounding errors.

It might even make sense to take this structure all the way to the player code in cases where it's needed, or just flatten to a single representation (likely sample counts) at the end (similar to what we currently do, but since it would always be the last thing we did, then changing things like operation order wouldn't affect the final output).

This is somewhat of a deep change that requires investigation.