vgmrips / vgmtools

A collection of tools for the VGM file format
GNU General Public License v2.0
123 stars 18 forks source link

Tempo scaler #22

Closed meyertime closed 2 years ago

meyertime commented 2 years ago

See #21.

This is at least working with the Green Hill Zone .vgm that I tested with. I started with a copy of vgm_ptch and stripped out everything I didn't need. Tested that it rewrote the .vgm correctly with no change. Then implemented the tempo scaling. (Basically on line 552.) It works by keeping track of the sample position within the song and scaling that to calculate the individual delay values.

I would appreciate some feedback or if anyone wants to test with some other .vgm files. In theory, I think it should work with any .vgm file, not just ones from the Genesis. Or if you know of a good selection of various files I could test with.

It does scale the PCM playback like I need it to, but some users may expect the sample playback to remain the same speed/pitch when changing the tempo. I think that would require a lot of work to scale separately and also involve detecting notes somehow. I don't personally have a need for that, though, so I don't plan on working on it.

meyertime commented 2 years ago

See https://github.com/vgmrips/vgmtools/issues/21#issuecomment-1100431512