Note that the version I am attaching here is "0.1.1" (opposed to the "0.1" on smspower), I did two minor improvements but it's basically the same. I'll align the versions later, hopefully with a "0.2" or something.
I'll release the source code soon, but it's completely uncommented for now and I think it would give everyone a headache.
UPDATE: see post below for version 0.1.2 complete with source code; it's still a complete mess, but I commented it today, so you might be able to read it, I don't promise you won't get a headache anyway, though.
As I said over there, please note:
- PSG only
- uncompressed VGM only
- up to VGM version 1.50