https://github.com/SergioFLS/mesen2vgm
Mostly did this as an exercise to understand more about the VGM file format. Also that I wasn't able to find an emulator that was accurate enough and logged VGMs (closest was MAME but wave channel is broken?). I mostly wanted one so I could record and listen to demoscene songs where GBS rips are either hard to find or don't exist at all.
So far it seems to work on everything I've threw it to (GBC, PCM audio).
I've also implemented some Game Boy Advance/GBA PSG support, though the wave channel might not play correctly on the current VGM players due to the extra features coming from the GBA (banking and double-width waveforms).
Anyway, hopefully someone enjoys this.
mesen2vgm: some Lua script for Mesen for recording Game Boy VGMs
Technical discussion about the VGM format, and all the software you need to handle VGM files.
Moderator: Staff
- Jlooky Offline
- Posts: 163
- Joined: 2023-05-18, 1:35:49
- Location: United States, Maryland / Also visiting inside game consoles/handhelds/computers from time to time.
- Contact:
- ValleyBell Offline
- Posts: 4962
- Joined: 2011-12-01, 20:20:07
- Location: Germany
Re: mesen2vgm: some Lua script for Mesen for recording Game Boy VGMs
It's great to see other people doing VGM mods/scripts as well!
I had a quick look and your timing code looks very good and should be free of accumulating rounding errors.
I have only one nitpick: You should write the "total sample count" header field (offset 0x18) when finishing the file.
GD3 tags would also be nice, but I don't know how complicated it is in Lua to do the UTF-16 encoding.
I had a quick look and your timing code looks very good and should be free of accumulating rounding errors.
I have only one nitpick: You should write the "total sample count" header field (offset 0x18) when finishing the file.
GD3 tags would also be nice, but I don't know how complicated it is in Lua to do the UTF-16 encoding.
Re: mesen2vgm: some Lua script for Mesen for recording Game Boy VGMs
I... forgot about that , should now be fixed in https://github.com/SergioFLS/mesen2vgm/ ... ecdd6face6.ValleyBell wrote: ↑2024-08-28, 22:18:17 I have only one nitpick: You should write the "total sample count" header field (offset 0x18) when finishing the file.
There's no library to handle UTF-16 encoding, though I don't think that's really a problem since the format is simple I could write an encoder myself.ValleyBell wrote: ↑2024-08-28, 22:18:17 GD3 tags would also be nice, but I don't know how complicated it is in Lua to do the UTF-16 encoding.
Re: mesen2vgm: some Lua script for Mesen for recording Game Boy VGMs
Added as of commit b7202c015ebdfecc20c61b49388a862f258fbddb.SergioFLS wrote: ↑2024-08-30, 18:39:24There's no library to handle UTF-16 encoding, though I don't think that's really a problem since the format is simple I could write an encoder myself.ValleyBell wrote: ↑2024-08-28, 22:18:17 GD3 tags would also be nice, but I don't know how complicated it is in Lua to do the UTF-16 encoding.
Also fixed EOF offset value in header in 04e173931010e4ee707671dc63c2b48e90f64fbd, which makes metadata display properly in vgmplay.
- alexanderjohn Offline
- Posts: 1
- Joined: 2024-10-25, 12:59:04
Re: mesen2vgm: some Lua script for Mesen for recording Game Boy VGMs
Great work, SergioFLS! This is a fantastic initiative for capturing Game Boy VGMs accurately. It's always exciting to see projects that enhance our ability to enjoy demoscene music. Looking forward to testing it out!SergioFLS wrote: ↑2024-08-27, 4:55:09 https://github.com/SergioFLS/mesen2vgm iq test free
Mostly did this as an exercise to understand more about the VGM file format. Also that I wasn't able to find an emulator that was accurate enough and logged VGMs (closest was MAME but wave channel is broken?). I mostly wanted one so I could record and listen to demoscene songs where GBS rips are either hard to find or don't exist at all.
So far it seems to work on everything I've threw it to (GBC, PCM audio).
I've also implemented some Game Boy Advance/GBA PSG support, though the wave channel might not play correctly on the current VGM players due to the extra features coming from the GBA (banking and double-width waveforms).
Anyway, hopefully someone enjoys this.