First post, by keenmaster486
- Rank
- l33t
Wrote a bunch of OPL2/OPL3 code for a game engine I'm writing, so I'm releasing this as a standalone player that plugs into that code, since it's rather useful.
Supported file types are IMFv0, IMFv1, DROv0.1, k1n9_duk3's KMF (see: https://k1n9duk3.shikadi.net/imftools.html), and an initial draft spec I've produced of an OPL3-compatible KMF called KM3, which I'm still working on, but I included a DROTOKM3 tool (32 bit, only DROv0.1 files supported, usage: DROTOKM3 <filename.DRO> - creates a new file called filename.KM3) that you can use to test the format. It should be a bit faster on slow systems.
Maximum file size is 192KB.
DROv2 files are not supported at this time. Convert DROv2 files to v0.1 using the dro2to1 tool that comes with DRO Trimmer, and then optionally convert them to KM3 with the included tool to see if they play any faster on your system. My tool converts the tickrate to 560 Hz for better compatibility with existing IMF player code.
System requirements:
- IBM PC or compatible with probably at least 256K free memory
- Sound Blaster or compatible (SB1/2 for OPL2 files, SBPro2+ for OPL3 files - no autodetection yet)
This is very barebones but the goal is for it to be as fast as possible. You should be able to play many files even on an 8088 at 4.77 MHz. More advanced files with a high instruction density will bog down such a system, though. I found through testing on emulators that an 8086 at 8 MHz is about the floor for the densest files I have (OPL3, lots of instruments, lots of rapid adjustments). (update: latest version should be somewhat faster playing OPL3 files - most of them should play almost full speed on 8088 4.77 MHz)
There is a configuration file that lets you set two parameters that will trade off between speed and compatibility.
oplDelays=true/false - turns on or off delays after writing to OPL registers. You need this on fast systems. Tested to fix compatibility issues all the way up to 486DX2/66 so far.
oplOptimize=true/false - turns on or off the "fastest possible code" I wrote that is nigh unreadable but faster than the normal code. Only supported for KMF and KM3 files as their structure lends itself to optimized dumps to registers. No OPL delays supported when this mode is turned on unless you're playing a normal IMF or DRO file. This should speed up KMF files more than KM3 files. OPL2 seems to be much less dense than OPL3 no matter what you do. NOTE: KMF files limited to the first 64K when this feature is enabled. I haven't found any KMF files that are greater than 64K, so this shouldn't be an issue.
Interested to receive testing reports.
I'm also interested in suggestions as to the best way to reset the OPL3 chip. Currently I'm just zeroing out every register, which causes an loud "thwip" noise, and sometimes doesn't work, leaving notes hanging.
Latest version (0.1.2025.04.18.1)
World's foremost 486 enjoyer.