don't click here

XM to smps converter: released

Discussion in 'Engineering & Reverse Engineering' started by nineko, Sep 10, 2007.

Thread Status:
Not open for further replies.
  1. SMTP

    SMTP

    Tech Member
    Its not useless, we just need a usable voice file. :P

    As I have the same problem Iceknight had, the UVB I have is the same as the one he had...
     
  2. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    VGM to smps conversion is completely possible. Just very hard to program because of the way vgm files are structured. You don't have notes and voices there, you only have writes on ports. For example, when you change a voice, the vgm file logs all the parameters sent to the YM2612, like attack rate, decay, and all that fancy shit, but there is no voice number. One has to read those values, convert them to the $19 bytes format and keep a log of them to see if they're used multiple times. Even worse for DAC samples, guess why.
    I may take a look into vgm to smps conversion eventually anyway.

    The main problem is that it works only with a limited number of songs, because of the Genesis limitations. While I admit that my converter isn't perfect and ignores some effects that could be correctly converted, it's also fair to say that a lot of XM features aren't possible on the Genesis hardware. Some kinds of songs, like chiptunes, that heavily relies on XM effects, aren't easily portable, and they are always going to sound wrong. The problem is that there are a lot of chiptunes out there, and when people begin to see that most of the songs they try to convert aren't coming out correctly, they're likely to think that it's my fault, and label my converter as useless. Ok, it works only on a few songs, say 5% of the total. But if you know how to use it it can still do a quite accurate job.
     
  3. Aquaslash

    Aquaslash

    <The Has-been Legend> Moderator
    Thirded. Though that's basically what Sonic QX is, it's still high time for an update. Perhaps you could include proper hi hat support.
     
  4. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    What do you mean? My converter writes a correct hi-hat channel, thanks to Tweaker. He told me the voice and pitch to use to get the best sound, and so I did.
     
  5. ICEknight

    ICEknight

    Researcher Researcher
    So after one day of figuring out stuff even I have been able to convert the wierdest of the chiptunes to something listenable, for working on my current mini-pseudo-project without being annoyed anymore by the Green Hill tune.




    So with the powers of Sonic justice and ear health, I hereby declare prohibited to release any Sonic mod with the original music, under penalty of being pointed at.
     
  6. Cinossu

    Cinossu

    Administrator
    2,832
    44
    28
    London, UK
    Sonic the Hedgehog Extended Edition
    .. c.c um, Sonic 1 Extended Edition, I kinda have to use the original music? :U But yeah, xm to smps conversion is brilliant. All we need now is a dedicated tracker.
     
  7. Aquaslash

    Aquaslash

    <The Has-been Legend> Moderator
    I'm sorry, I was talking about Sonic QX there, which doesn't have hi hat support at all. I should have clarified a bit more.

    EDIT: Oh..and nineko for Tech Member kthnx
     
  8. ICEknight

    ICEknight

    Researcher Researcher
    Ouch, just when I was going to convert another file I got the numbers 9, 486.

    Do I win something? =(
     
  9. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    Most likely you were trying to load a song with a lot of channels, and it ran out of memory.
    Don't forget that this tool works under ms-dos and its heavy memory limitations, so a 32-channels XM will probably crash everything.
    Since you can't use more than 9 channels on the Genesis anyway, you should trim them down with a tracker before you attempt the conversion.
    If this is not the case, feel free to PM me and send me the XM you were trying to convert, this would also help me to find bugs and issues. Don't forget that I released this thing without a proper beta test period, so feedback is really appreciated.

    I know that the XM loader is buggy as hell, most of its code was rushed and I've been promising to fix it asap, but unfortunately my real life is being a mess in these days so I haven't had the chance yet.
    I'm really, really sorry if I can't update this thing as I wish, and this buggy beta is still around, but I have other priorities right now.

    Hold on a few more days for the update, please.
     
  10. ICEknight

    ICEknight

    Researcher Researcher
    Hey, that was it. It had a lot of empty channels, so I just trimmed them and it worked.


    Now it sounds quite good, except for the speed... Using a tempo of 02 makes it too slow and 01 plays way too fast. Is there any other way to change this? :)
     
  11. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    Changing the tempo in Sonic 1 is painful because of the limited choice.

    Right now my converter is hard-coded to output a tempo of 03 02, because I found that it's quite similar to the "standard" tempo in module files (125 and 6), but another thing on my HUGE to-do list is to find a formula to relate the tempo in the module with the tempo in the smps.
     
  12. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    16
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    The tempo has two bytes. Try 0200 or 0102.
     
  13. ICEknight

    ICEknight

    Researcher Researcher
    Ah, didn't notice there were actually two values for that. It now sounds great using 03 52.

    Thanks, guys.
     
  14. ICEknight

    ICEknight

    Researcher Researcher
    Okay, after a lot of experimenting these are the only things I've missed:

    -Support for "pattern break", when each pattern isn't reaching its limit.
    -Support for "pattern jump" (thus being able to loop the music from anywhere).
    -Utility to move certain instruments to other tracks (useful when the drums share channel with other instruments, since you can't assign the channel to both).
    -Automatic speed adjustment (the output speed isn't always correct).


    And most important...
    -Possibility of reading all the parameters from an external file. It's really annoying having to start all over again if you screw up in the very last settings...
    You could make it so if you specify a DAT file instead of a XM, it just does everything automatically.


    I've been able to successfully convert MIDIs, NES music and chiptunes without much more trouble than the usual screw up when typing and some out-of-tune instruments.

    This utility is great.


    PS: Sorry for the double post.
     
  15. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    Not implemented by purpose. XM files can have patterns of any lenght, so there's no need to read Dxx commands.

    Right, this version can only loop the whole song. MOD and XM files, however, have a setting that allows you to specify the start of the repetition. I'm already reading that value from the XM header, I'm just not using it yet (still because of the problem on the loader). Once I can handle that value, you will manage to have songs in the (intro)(loop)(loop)(loop)... format. Since this is the same thing you can achieve by a Bxx command, it's staying out as well.

    Good idea. Hard to implement, but I may take a look at it. Right now I'm just moving all the drums by hand, but I admit that it's boring.

    Yup, one of the next things on the to-do list. It will still be approximated, because of Sonic 1.

    Right, I thought about that, but I don't know how to do that. Say that you load all the parameters you set when the conversion went wrong, it will go wrong again. Maybe I should consider the option to add a GUI on top on this, and send the parameters via the command line.

    Thanks. And sorry if I basically said "no" to all of your points.
     
  16. ICEknight

    ICEknight

    Researcher Researcher
    Well... It's a bit annoying having to trim each pattern when the guy who made the XM decided it was a good idea to use Dxx instead.

    Oh well, I'll have to live with it.
     
  17. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    All the commands used in older MOD files were included also in XM, S3M, and IT files to make them backwards compatible with the original format. Patterns had to be 64 lines long in MOD files, so changing the lenght wasn't an option, and the Dxx command was needed. Now it's kinda redundant, but I may look into supporting it eventually.
     
  18. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    Ok guys, time for an update. Sorry if this is another double post for me.

    Anyways, I finally got to completely rewrite the XM loader, now it's much better.
    All the features present in the previous release are still there, and I added some new things.
    1) Panning now works; because of the Genesis limitations, however, you can't pan PSG channels. Only and FM and DAC channels support it. To pan a note, use the 8xx command in the XM. A module file supports 256 levels of panning, so I had to drastically decrease them. As a result of this, 800 to 87F will be left, and 880 to 8FF will be right (I may make this customizable in the future anyway). According to the XM syntax, panning is reseted to centre each time it's not specified. This means that all the notes played without an 8xx command will be played on the centre.
    2) You can now have notes and rests longer than 127 (only rests for the DAC channel since the E7 flag is ignored there). There seems to be a timing issue with long notes anyway, and I don't know how to fix it, since my output is correct. It seems that if a note is too long it will just be played shorter, despite of its real lenght. It probably has something to do with the tempo, and I will look into that again.
    3) Custom loops are completely working. This means that you can have a song with an introduction that doesn't loop and then a section that repeats. You can also set a song to play only once (e.g. an ending song, or the game over tune). To set the looping part of a song just use the "restart position" field in the module. Please note that S3Ms and ITs don't support that value, so if you set it before you convert it to XM it will be lost. MODs support restart position as well.
    4) IceKnight will be happy to see that I included support for Dxx commands as well. However, they will all be rendered as a D00, so you should double check that if you have D01 to DFF commands.
    5) The output file is no longer named out.bin: it will be the XM filename with a nice ".bin" after it.

    Dxx and 8xx are MOD/XM effect numbers; for S3M/IT they are Cxx and Xxx respectively. You should check if your tracker uses a different notation btw.

    All the bugs/limitations from the previous version are still present if not differently stated above.
    This means that the volume control doesn't work yet, and I think I'll never manage to support it at all.
    Also, the output file will still be unoptimized, but this is something I'm going to look into soon, as well as some kind of support for pitch bends.

    Download xm2smps 0.2 here: http://digilander.iol.it/projectchaos/smps/xm2smps.exe
    I may decide to create a simple webpage with all of my programs anyway.

    Well, enjoy.

    edit: I forgot to say that this isn't really tested yet, so you may encounter some bugs. If you do, please report them to me, thanks.
    re-edit: I found a bug so I had to reupload it. If you downloaded it before I made this edit you should download it again.
     
Thread Status:
Not open for further replies.