AntonioND/gbt-player

[Request] vgm2gbt

clsource opened this issue ยท 5 comments

Hello, great tool!

is possible to create a vgm2gbt converter? or use a GBS file?

http://www.smspower.org/Music/VGMFileFormat?from=Development.VGMFormat

In that way music created with https://www.littlesounddj.com/ could be exported to vgm in an emulator and later used in games.

Thanks :)

The problem is that the current workflow isn't converting from mod to gbt. It actually converts from a specific mod file to gbt (https://github.com/AntonioND/gbt-player/blob/d3e57ac2742c7e7b651b7914d72bb52a84378420/mod2gbt/mod_instructions.txt). I only use mod as storage format because that way I can use any tracker to edit music rather than creating my own music editor and format to store the songs.

That mod file has a very specific set of instruments that sound like what the player would sound in the GB. You can't modify them (except for channel 3 and 4, but that's a different story). Also, because the mod format and the GB audio circuit don't map 1:1, some GB effects can't be supported because the mod format doesn't support them (and some mod effects can't be used in the GB because of the same reason).

As far as I can see, VGM removes some of my restrictions. in the case of LSDJ the player and editor are the same, so you can support everything. In the case of GBS, same, you can support everything.

In short, in order to be able to support the formats you mention I have to give up the workflow I created, which is the main reason why I did it like this. As I mention in the readme, I based my work on Lemon Tracker. The idea was the same: converting mod files to something that the GB could play. Unfortunately, the website is down, but you can find it in this project: https://github.com/elfgames/doctorhow/blob/c1aeb4c8ab5c71c3c00ea156438c97096523bf78/utils/LP1.297a.c The problem I found is that... well... it's in C, it's slow, and it was more limited than what I wanted. I simply decided to start from scratch and reuse that idea.

There are already other players like Carrillon player (http://www.pouet.net/prod.php?which=17337) that are closer to what you mention, but that force you to use the GB (or an emulator) to edit songs. That's what I wanted to avoid. On the other hand, they are much more flexible than GBT.

Thanks for your answer.

The reason I'm asking this is to try to integrate such formats in GB-Studio https://github.com/chrismaltby/gb-studio

A windows/linux/osx tracker that exports GBS is http://deflemask.com/

currently, I don't know much about gameboy development.

If you could give me some directions on how to use raw gbs files with gbt player,
that would be awesome.

mod files are great nevertheless, so if this cannot be achieved thats ok too.

Thanks again ๐Ÿ‘

I've noticed a lot of traffic to this repository since GB Studio came out, yes. xD

I don't know much about GBS, but according to the comments in chrismaltby/gb-studio#44 it is a raw dump of what a program writes to the sound registers of the GB. If that's the case, it's a completely different concept.

The way GBT works is by transforming a MOD file into a format that is pre-converted for the GB. All it does during this step is to make it easier for the GB to read each pattern, but all the structure of the patterns is still there. The player needs to read the data, interpret it and convert it into actual hardware register writes. For example, a command may be "Note C5, instrument 2, volume 5". This is converted into a series of writes to the hardware registers. If at a specific step nothing has to be done, the command is "do nothing".

GBS as far as I understand is a bunch of "write X to register Y" and "wait Z cycles". There is no conversion needed in order to play the music. Actually, music players that play GBS in PC must emulate the GB sound hardware. In order to play GBS songs, it's the player itself the one that has to completely change. Either that, or I create a converter that interprets the music, tries to guess what the composer did, recreates the patterns, and outputs GBT data. This is far from being a good idea, of course.

The thing is that I'm not even sure what's the more efficient option regarding data size and CPU usage. I just wrote it this way because I could get it done fast. I've been thinking for ages to rewrite this from scratch and take a different approach, but I'm not even sure what the right approach would be.

Also, GBDK is really painful when you are writing assembly code. The assembler is much more limited than RGBDS, the one I normally use. This makes me even less interested in rewriting the player, seeing that most of the people that are interested in my player use GBDK. I could take the approach of building RGBDS code, importing the raw binary with code into GBDK code, and providing some hooks for GBDK, but yeah, not ideal.

I believe I understand better now. So GBS cannot be used because is a more raw file than a mod. In that case a solution I think could work is having deflemask as a bridge.

Here are the specs for a deflemask file

http://www.deflemask.com/DMF_SPECS.txt
http://www.deflemask.com/DMP_SPECS.txt

And some forum threads

http://www.deflemask.com/forum/general/dmf-specs/
http://www.deflemask.com/forum/rom-builders/deflemask-gbs-hardware-player-source/

The idea is that Deflemask acts like a converter from vgm file formats and output dmf files that could be converted to gbt and used in games.

Example DMF (compressed with Zlib)

megaman_v_stageselect.dmf.zip

๐Ÿ‘

Thanks @AntonioND for all your comments ๐Ÿ‘ and good vibes . I will keep looking around to see if I can do something about converting those formats and maybe others. If I got into some troubles maybe I can comment again. ๐Ÿ’ฏ. Great work! :).