Skip to content

OPL, OPLL, OPL2 and OPL3 to OPM voice conversion?

YM3526, YM2413, YM3812 and YMF262

Technical discussion about the VGM format, and all the software you need to handle VGM files.

Moderator: Staff

OPL, OPLL, OPL2 and OPL3 to OPM voice conversion?

Post by vampirefrog »

Hello, I am looking for an algorithm or an explanation on how to convert 2-op FM voices to 4-op. Mostly I am looking for how to convert the different parameters. Is there some text on this somewhere, or does anyone have a clue how one would do this? Is it even possible for all chips? Is it possible for all situations? I am sure at least some voices could work.

Thanks in advance!
  • User avatar
  • grauw Offline
  • Posts: 150
  • Joined: 2015-02-22, 3:40:22

Post by grauw »

The biggest problem is that the OPLL and OPL2 and up support non-sine waveforms, while the OPM only supports sines. So this essentially limits your selection to OPL-compatible sounds.

Other than that, the parameters should be fairly translatable… with 2-op there are only two algorithms, “frequency modulation” and “additive” where the operators are either placed in series (modulator -> carrier) or in parallel (carrier + carrier). For the former you could use OPM algorithm 4, for the latter OPM algorithm 7 (which are the two least 4-oppy algorithms), and only key-on the operators that you’re actually using, or set the TL of the unused operators to maximum attenuation (note, this isn’t fully muted, but pretty much inaudible).

Then it should be mostly just a matter of translating the rest of the parameters, taking care to check the OPL and OPM application manuals for the exact conversions:

* TL - same values (OPM has one extra bit for -48 dB)
* MUL - OPL can not specify multipliers of 11, 13 and 14. Map values 11 -> 10, 13 -> 12, and 14 -> 15
* FB - same feedback values
* AR/DR/SL/RR - OPL has a envelope generator which can do ADSR and ADD depending on EG-TYP setting, OPM has “ADDR” which can mimick both OPL versions I think; ADSR by setting D2R rate to 0, ADD by setting D2R to the RR. Note that the rate values seem to be different, so you need to perform a conversion calculation.
* KSL/KSR - OPM only has a single KS value so you need to perform some kind of conversion, but I don’t think this is very sensitive so if it’s a bit off it’ll probably be ok
* VIB - maps to PMS + PMD; VIB selects 7 or 14 cent, PMS selects 0, 5, 10, 20, 50, 100, 400 or 700 cent, but can adjust the scale with PMD (global). The LFO frequency is 6.4 Hz, can be set on OPM with LFRQ (global).
* AM - maps to AMS + AMD, AM selects 1 dB or 4.8 dB, AMS selects 0 dB, 24 dB, 48 dB or 96 dB, but can adjust the scaling with AMD (global). The LFO frequency is 3.7 Hz, can be set on OPM with LFRQ (global).

Something along those lines. I would first just convert the values as trivially as possible to get a first sound as a proof of concept, then implement and fine-tune more accurate conversion calculations.

Post by vampirefrog »

Thanks, Grauw! Is this for a specific clock?
  • User avatar
  • grauw Offline
  • Posts: 150
  • Joined: 2015-02-22, 3:40:22

Post by grauw »

OPM and Y8950 (OPL+ADPCM) application manuals both assume a clock of 3579545 Hz. The whole OPL series is based on the same clock, generally, even though OPL3 and OPL4 use different clock inputs values they internally divide to (almost) the same. The differences in envelope generator rates are not due to different input clocks but either due to a different internal clock division of the EG (which is clocked separately), or a different mapping of rates, I think. Comparing the tables in greater detail should give a general impression of the exact conversion needed. Key scaling is probably also a bit different due to the difference in how notes are specified, but I think not significantly.

Post by vampirefrog »

is there a commonly used file format for storing 2-op OPL* voices?
  • User avatar
  • MaliceX Offline
  • Posts: 226
  • Joined: 2012-09-29, 11:45:48
  • Location: Australia
  • Contact:

Post by MaliceX »

-dj.tuBIG/MaliceX
Post Reply