don't click here

mid2smps

Discussion in 'Technical Discussion' started by ValleyBell, May 22, 2011.

  1. Mr Lange

    Mr Lange

    A wise guy eh. I know how to DEAL with wise guys. Member
    1,286
    11
    18
    The Land of Waldos
    Sonic Utopia, Sonic Overture
    I am using Gens Rerecording, but that makes sense. I didn't even consider a savestate. Thanks, I'll try that later.
     
  2. ICEknight

    ICEknight

    Researcher Researcher
    I keep reading all those "now I can finally stop using the XM format". Is there anything about it that MIDIs do better?

    I remember XMs being quite easy to make and edit with programs like ModPlug Tracker, and they can do a lot of things MIDIs can't. So what's the deal?
     
  3. nineko

    nineko

    I am the Holy Cat Tech Member
    6,298
    475
    63
    italy
    No, it's just that there are a lot of MIDI fanboys around, even though the XM format is a much better choice when it comes to convert something to smps due to the whole lot of significant similarities between them (at least in my opinion). Back in the day it would have been easy for me to focus on a MIDI to smps converter since I know the MIDI specifications quite well, but in the end I decided to focus on XM conversion not because of a lack of skill on my side, but as a deliberate choice, which I don't regret.
    The one thing in which MIDI files are similar to smps is how pitch bends are handled, since XM files handle pitch bends in a completely different way (ironically, the Cube sound driver handles pitch bends (and vibrato) in the exact same way, meaning that XM to Cube conversions would be almost flawless), but this is something we didn't know back then. The lack of volume control in my XM to smps converters instead *is* due to my lazyness, since I didn't feel like working out a formula to turn a 0..64 linear range into a 127..0 logarithmic range, something I later did for my MIDI to vgm converter, when I wrote a formula to turn a 0..127 linear range into that same 127..0 logarithmic range, although with TmEE's help.

    All in all I am still skeptical about a MIDI to smps converter, but in an attempt to be positive I decided to help, as I said, by writing a powerful 2612 instrument editor for ValleyBell, which I sent him a few days ago.
     
  4. ICEknight

    ICEknight

    Researcher Researcher
    Oh, I see... Have you guys considered joining forces to make a more general MD music app that combined both worlds? That would be badass.
     
  5. Herm the Germ

    Herm the Germ

    Hmm, not bad. Well done, doctor! Member
    1,482
    0
    0
    Dresden, Saxony, Germany
    MIDI-to-SMPS-conversions, mostly. Takin' requests, too.
    I'unno, personally, I could never figure out the XM2/3/4SMPS well enough to produce anything that sound even remotely like the intended melody. This on the other hand seems to work quite flawlessly, just needs the ability to move data in the ROM so we don't overwrite everything else. :B
    Still, awesome job thus far. Pacing through Green Hill Zone with "Showtime (Original Mix)" playing is quite a different, invigorating experience to me. : D
     
  6. Mr Lange

    Mr Lange

    A wise guy eh. I know how to DEAL with wise guys. Member
    1,286
    11
    18
    The Land of Waldos
    Sonic Utopia, Sonic Overture
    I'm happy to report I got a song working. It sounds nice, granted I didn't polish it much. I don't know how much I could get it to do though, in terms of effects and whatnot. Any word on that? I can say that no matter how hard I tried and all the steps I took, xm2/3/4smps never worked for me at all. After replacing the right files and compiling the rom, the sound would permanently turn silent in the game whenever the song was supposed to start. At least with this tool I can have some fun with Sonic 1.
     
  7. Tanks

    Tanks

    Member
    1,048
    108
    43
    I was messing with it the other day. I couldn't get SOME to work with my edited Sonic 1 ROM so I just messed with some of the other ymx files lying around. I guess I'll have to wait for ninenko's instrument changer to be implemented.
     
  8. nineko

    nineko

    I am the Holy Cat Tech Member
    6,298
    475
    63
    italy
    Just to clarify, you shouldn't be expecting any release from me at this point, as I sent my source code to ValleyBell, who is improving it as we speak. I don't know if I should spoil this just yet, but 18 hours ago he replied to my email with a private beta of the improved editor, and everything was perfect aside for a couple of very minor things, so I wouldn't be surprised if the release will be soon, but don't take my word for it.
     
  9. ValleyBell

    ValleyBell

    Tech Member
    246
    25
    28
    researching PC-98/X68000 sound drivers
    I just updated the tool. It now includes the new instrument editor.
    Link is on the first page (or here).

    I haven't yet startet to change the layout of mid2smps, I just updated the tool to properly support the new gyb instrument files. (ymx files are still supported btw)

    Notes to the instrument editor:
    - SMPS doesn't support the SSG-EG, so leave it disabled until you want to play with it
    - The "Transpose" field describes how much the instrument is transposed. (so if it plays an octave higher than it should, change the value to 12, not -12)
    That may be the exact opposite of what you might expect.
    - There's no real readme (yet), just a list with keys for the preview button.

    Have fun!
     
  10. nineko

    nineko

    I am the Holy Cat Tech Member
    6,298
    475
    63
    italy
    Glad to see this released, I hope that now people can stop complaining about YMX files :v:

    A note about the new instrument format: I decided to call it "GYB" upon a suggestion by Sik, which stands for "Genesis YM2612 Bank". It can contain 255 "melodic" instruments, which have to be mapped to the 128 General Midi instruments, and 255 "drum" instruments, which have to be mapped to the [less than] 128 General Midi drums. The drum bank isn't used yet as far as I know, but it might be used in some future applications (e.g. for FM drums or something), just don't use it for now and focus on the melodic instruments. Note that this is another attempt to turn page and stop calling them "voices" when they should be called "instruments". Once you assign an FM instrument (e.g. "That piano from Sonic 3") to a GM instrument (e.g. "Bright Acoustic Piano"), that FM instrument will be used in the conversion every time that GM instrument is used in the MIDI (at least, this is the intended behaviour, I've yet to test the converter itself because I am on my laptop right now and I have no hacking tools whatsoever here, so I'll just guess that ValleyBell did it right :v: ).

    Another small note is that the editor will automatically "fix" any register bytes which are in a wrong range right now, by setting unused bits to 0 (e.g. there are some instruments which use a TL of $80 when it should really be $00 since the TL is a 7-bit number). This doesn't change the sound of the instruments in any way, it just make them more standard. This is to say that you shouldn't be surprised if you import an instrument and you see different bytes than the ones you've been used to.

    I am a bit surprised that you decided to use the transposition value backwards, but as long as that's made clear I am ok with it. And I am glad to see that you gave mid2smps the icon I designed for you (the Sonic head over the MIDI logo) :v:
     
  11. ICEknight

    ICEknight

    Researcher Researcher
    Does that instrument assignment mean that it will be possible to have this program automatically choose the instruments that sound more similar, each time you convert from one format to the other?

    Not sure if I understood that one correctly...
     
  12. nineko

    nineko

    I am the Holy Cat Tech Member
    6,298
    475
    63
    italy
    No; let me try to explain it again.
    You know that the General MIDI standard defines 128 instruments: Acoustic Grand Piano, Bright Acoustic Piano, and so on. These instruments are used in MIDI files, and are selected by "Program Change" events (MIDI event $Cx). Of course newer standards such as the Roland GS and the Yamaha XG expand the instrument selection by using two MIDI controllers, but this doesn't matter for what we're going to do here (e.g. we can consider Roland GS's Synth Bass 3 to be instrument 38 just like Synth Bass 1); if you want to know more about this I'll be glad to talk about it, but I don't want to make things harder than what they are.
    Back on topic, this fixed set of instruments is different than what we have in XM files, where everyone can use random instruments numbered in any way, which means that all the instrument mappings can be done once and for all instead of being redone every time you convert a file like you did with XM files, which is why the instrument assignments are now stored in the GYB file itself unlike X3V files which only contained instruments without any assignment.
    So, once you create a GYB file, you might as well keep it forever and forget about it. What you have to do, once, is to populate it with your FM instruments, importing them from various formats such as TFI, and then you manually assign those FM instruments to one (or more) GM instruments.
    Say that one of the instruments you imported is "My super happy Synth Bass!.TFI"; of course you want it to be used for Synth Bass, so you select "Synth Bass 1" from the GM instruments list, and then you select "My super happy Synth Bass!.TFI" from the FM instruments list. In this way, every time you'll convert a MIDI file which uses Synth Bass 1 (or Synth Bass 3, or any other GS/XG variations over that), you'll get an SMPS file which uses My super happy Synth Bass!.TFI
    Of course you don't need to assign all the 128 GM instruments to something, as some of them are rarely used if at all, and I doubt you're going to convert a MIDI file which uses the Helicopter instrument or something; focus on the ones you're more likely to need, and keep in mind that you can use the same FM instruments for several GM instruments if you're lazy (you can assign My super happy Synth Bass!.TFI to Synth Bass 2).
    Vice versa, the fact that you can store 255 instruments in a GYB file also allows you to keep spare ones in case you need more variety, so if you feel like using "Another great Synth Bass!!!.MVS" for a particular conversion, all you have to do is to change the assignment from the aforementioned comboboxes.

    I hope this is a bit more clear.

    edit: here you are a couple of screenshots of the instrument editor:
    [​IMG]
    The normal view. You can create new instruments, or import them from files. When you click on an instrument from the list (in this case, "Pan Flute"), it shows you all the parameters (detune, multiple, ...) for that instrument, which can be edited and previewed on the fly. This screenshot also shows that the GM instrument "Electric Bass (pick)" has been assigned to the FM instrument "Picked Bass" (which you can't see on the list because it's somewhere offscreen, but it's there, otherwise it wouldn't show up in the assignment combobox).

    [​IMG]
    When you import an instrument, you can view its parameters and preview it, but you can't edit it until it's imported. You have the option to mass-import all the instruments from an YMX or a X3V file.

    This is basically it. I am going to upload those pictures on the wiki and write a small article about the editor as soon as the site will be responsive enough to let me preview the page in a decent amount of time.
     
  13. Mr Lange

    Mr Lange

    A wise guy eh. I know how to DEAL with wise guys. Member
    1,286
    11
    18
    The Land of Waldos
    Sonic Utopia, Sonic Overture
    You've created the most useful program for another program ever.
     
  14. TmEE

    TmEE

    Master of OPL3-SA2/3 Tech Member
    1,726
    2
    18
    Estonia, Rapla City
    T-04YBSC-A !
    Nineko, you said you wanted all the parameters to be very descriptive.... have TL use decibels instead of just number. 1 step is 0.75db starting from zero. But other number alone values should be sliders to maximize productivity.
     
  15. ValleyBell

    ValleyBell

    Tech Member
    246
    25
    28
    researching PC-98/X68000 sound drivers
    [​IMG]
     
  16. ValleyBell

    ValleyBell

    Tech Member
    246
    25
    28
    researching PC-98/X68000 sound drivers
    I doubt that I'll work in it soon, so I'll just leave this here: mid2smps 0.3 beta

    Updates:
    - I rewrote some parts of the code and fixed many bugs v0.2 had.
    - There is now a mappings editor (including FM drums), an editor for the DAC sound list and a PSG editor.
    - There's a nice tempo calculator that shows you all tempi of the currently loaded MIDI and their respective value + BPM of the converted SMPS.
    - The tempo calculator window features a frame calculator. (You'll need that, if you want to play with NoteFill and Modulation Delay controllers.)
    - I integrated 2612edit (it can import VGMs/VGZs now, btw)
    - You can use MIDI Controllers to make custom Modulation effects now. (See the included controller txt file and the Music Hacking Guide for reference)
    - I added a range limiter for SMPS notes (to prevent reading frequency values from the code section)

    Bugs and Notes:
    - The range limiter may limit too much, depending on the transpose value of the instruments. (will be fixed in final version)
    - The instrument editor doesn't share its instrument data with mid2smps yet. (will be fixed in final version)
    - If you have FM drums on a channel, you can't have normal notes on it. (Well, you can, but you need to use extra instrument changes.)
    - The MID2SMPS button is a shortcut for File->Open + File->Save after each other.

    Also included:
    - Midi Splitter: Helps you to split accords into multiple tracks.
    - SMPS Optimizer: I recommend to run this on finished songs, because mid2smps writes unoptimized files. This should also work on xm234smps output.

    I recommend SMPSPlay to test the songs, btw.

    Have fun!
     
  17. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    Nice work, it's good to see you're still working on this and making an alternative way from using XM's. I'm still going to use you for the music in S2R though, don't think you can escape that easily =P
     
  18. n00neimp0rtant

    n00neimp0rtant

    EYES ONLY Member
    262
    0
    0
    South Park, PA
    Creation Kit (Skyrim mods and patches)
    I've spent all day searching for an answer but I can't find one: I'm completely new to music hacking and I have no idea where to inject the output .bin file into the ROM
     
  19. ValleyBell

    ValleyBell

    Tech Member
    246
    25
    28
    researching PC-98/X68000 sound drivers
    In an older version you could inject the songs directly in a ROM, but since the exported files are very large, I removed that feature. (The chance of overwriting sound driver code was too high.)

    I recommend using a disassembly and replacing one of the sound\music##.bin files. That works fine and you don't need to care about the ROM checksum either.
     
  20. n00neimp0rtant

    n00neimp0rtant

    EYES ONLY Member
    262
    0
    0
    South Park, PA
    Creation Kit (Skyrim mods and patches)
    Thanks VB. It seems that I'm catching onto this music hacking thing relatively fast thanks to your (and Nineko's) tool. Got a couple more questions for you, if you don't mind:
    • I was able to use a tool called "Sonic One Music Editor" to dump all of the voices for any S1 song into a single .ymx file. How can I do this with S2 and S3K? Or, better yet, are there pre-dumped voice banks available around anywhere? (I've looked everywhere I could but couldn't find any)
    • I've got mapping MIDI instruments to FM/DAC channels totally figured out, but I'm quite clueless about the PSG channels. How do I map these to a MIDI instrument?