Wohlstand / OPN2BankEditor

A small cross-platform editor of the OPN2 FM banks of different formats (Downloads in README below)
GNU General Public License v3.0
42 stars 8 forks source link

add YMX format loader #56

Closed jpcima closed 5 years ago

jpcima commented 5 years ago

It's the revision 0 of format which has existing banks in, not revision 1 specified on sega retro. Sources are found in Sonic ROM editing tools.

Instrument payload is formatted as SMPS. https://segaretro.org/SCHG:SMPS_Hacking/Voices_and_Samples It's as usual data formats except operator's fields were interleaved.

Some instruments sound good ~and some are crap~ (FIXED), test it.

jpcima commented 5 years ago

One of crap sounding voices is Small Pipe from Saxman.ymx. The bank was available with a readme:

0 - GrandPiano
1 - ElectroPno
2 - Small Pipe
3 - Trumpet81Z
4 - ElecBass 1

DESCRIPTION:
This YMX bank includes five select Yamaha TX81Z voices. All of these voices
come from the original ROM banks that are installed on the TX81Z. Three of
them come from bank A, one from bank B, and one from bank C. I feel that these
voices would sound good with just about any song. I have limited the bank to
five voices to save space when attaching it to your General MIDI import. You
are free to customize this bank in any way you would like. More Yamaha TX81Z

It can be observed that the software xm4smps-4.1 (open source), performed a byte swap before it's copied in the raw memory. I tried but it hasn't been of help. Search uchar voice[0x19]; // I hate byteswapping :/ in main.ui.h.

Tried rewriting as this code.

        if(1)
        {
            std::swap(v.idata[0x2], v.idata[0x3]);
            std::swap(v.idata[0x6], v.idata[0x7]);
            std::swap(v.idata[0xa], v.idata[0xb]);
            std::swap(v.idata[0xe], v.idata[0xf]);
            std::swap(v.idata[0x12], v.idata[0x13]);
            std::swap(v.idata[0x16], v.idata[0x17]);
        }
jpcima commented 5 years ago

I should add it's fixed now and patches play fine. Exporting works, except it saves 128 instruments max; the instruments imported fine and played in the software SOME.

Wohlstand commented 5 years ago

Took! Will merge other stuff... Yeah, conflicts are came, but, they are easy to fix :fox_face: :wink:

jpcima commented 5 years ago

Tx81z will be fine because it's based on top of this branch. Not s98 however, which has been made on master. This one needs to adapt the enum.