First post, by DragonSlayer
DOSBox Guide To OPL3 Passthrough Using Yamaha YMF7x4 Sound Cards
In this guide I intend to lay out the steps necessary to get a Yamaha YMF7x4 series sound card to output legacy OPL3 FM modulation and pass that through to DOSBox in order to replace the poor quality built in OPL3 emulation in DOSBox.
This has the obvious benefit of sounding much better and truer to the original but it will also speed up DOSBox by not having to waste CPU time to emulate the OPL3 chip which should help out on slower systems.
I did all of this on Windows 7 32-bit, but it should also work on Windows XP, Vista, Windows 8 and perhaps even on Windows 10 32-bit.
Note that this will only work on a 32bit version of Windows since Yamaha has never released 64bit drivers for this series of sound cards.
It should also be noted that the sound quality from the Yamaha YMF7x4 series sound cards will not be as good of quality when using the Windows XP and above drivers as it is when running under Windows 98 with the Windows 98 drivers. This is especially observed when playing MIDI files with the Yamaha synthesizer and I have confirmed this to be true.
This is, of course, taking into account that I was using the utility "PowerYMF" under Windows 98SE to tweak all of the settings to their highest quality and some of those settings don't even exist in the Windows XP and above drivers. That and they degraded the quality of the drivers when they wrote the Windows XP and above drivers.
This is all explained in the FAQ for PowerYMF. The FAQ is in Russian, but you can use Google Translate to read it and it is mostly comprehensible. This can be found here: http://www.trancein.com/articles/ymf-faq/
Even though specifically I was using a Labway Model A301-G50 with a Yamaha YMF724F chip, this procedure should also work on pretty much any Yamaha YMF7x4 series card from any manufacturer.
Yamaha YMF7x4 refers specifically to Yamaha YMF724, YMF740, YMF744, YMF754 and YMF764 models. The YMF740 is identical to the YMF744, except that it lacks the Sondius-XG VL waveguide synthesis module.
This guide should, in theory at least, work for all of these models.
This guide is the culmination of several months worth of research into how to get 100% genuine OPL3 sound out of my vintage DOS games on a modern computer with a modern OS. It is my hope that this guide will save others the great effort, frustration, time and money that I've put into this project up till now.
The things that you will need to follow along with this guide are, a Yamaha YMF7x4 series PCI sound card (obviously), a motherboard that will actually allow you to use said card (not as easy as you might think), and a version of DOSBox that will allow for FM passthrough from the OPL3 chip on the sound card.
I happened to use the YKHWong's DOSBox Daum version because there is an older version that will also work on Windows 98 SE which is where I started this little adventure. I started with Windows 98 because you don't have to do anything special to install a Yamaha YMF7x4 in Windows 98 using stock drivers, unlike newer versions of Windows which require special drivers and special installation procedures for everything to work properly.
That being said, this method should theoretically also work in other, newer, versions of DOSBox that support hardware OPL3 passthrough as well.
If you want to use YKHWong's DOSBox Daum version the best versions to get, in my opinion, are 2011-05-25 because it was the last version with Windows 98 support and version 2014-01-27 for best game compatibility.
If you download the version for Windows 98, you will also need to download the DLL files and unzip them into the same directory or else it won't even start up.
YKHWong's DOSBox Daum version can be downloaded here: http://ykhwong.x-y.net/
This method should also work on DOSBox-X, but so far I've not been able to get that one to work properly. If anyone has gotten OPL3 passthrough to work in DOSBox-X please post and let us know what you did differently to get it working because I would really like to get this working in DOSBox-X as well.
It should also be noted that finding just the right motherboard can be a real pain since, for the last few years, many motherboards don't even have true PCI slots anymore. Instead, they have PCIe slots with a special chip that emulates PCI and so some will work with a Yamaha YMF7x4 card and some won't. It all depends on how good that chip does it's job and it often comes down to whether you have your BIOS configured correctly.
There are several threads here on VOGONS that describe which motherboards are likely to work and which ones definitely won't work so it would pay to do your homework before you actually buy anything.
Also, different revisions of the same model motherboard can act very differently so this should also be taken into account.
As an example, I've got 2 very similar motherboards that IIRC have the same exact Intel chipset and take the same exact CPUs, but one works perfectly with the Yamaha sound cards and the other won't even recognize that there is even a card plugged into the slot!
The first thing that you will need to do is to download the following driver for your Yamaha sound card. This may also work with other drivers, but this one should work for sure.
Yamaha YMF7x4 Driver
Unzip this driver into any directory, then use either the program i6comp or UniExtract to extract the contents of the "data1.cab" file into the same directory, not a subdirectory.
The program UniExtract, which I like to use, can be found here: http://www.legroom.net/software/uniextract
Delete the file "NLDS1Y03.INF" that was part of the wdm754_5245.zip file that you just unzipped.
Download the following file and put it in the same directory that you just deleted NLDS1Y03.INF from and rename it to NLDS1Y03.INF
If you need to, temporarily block your internet connection so that Windows won't download another driver against your will.
Go to Control Panel, then Device Manager and then uninstall the existing drivers for your Yamaha sound card. Right click on them and tell Windows to uninstall and to delete them. You do not want to use the driver that comes with windows for these sound cards.
If Windows is being stubborn about doing this, you can run the program dsuninst.exe that is in the wdm754_5245 driver directory and it will delete all existing installed Yamaha sound card drivers.
Remember to run dsuninst.exe as Administrator. I also told it to run in XP compatibility mode as well, just for safe measure. In fact, all of these Yamaha programs should be run as Administrator and in XP compatibility mode because most of them won't work unless you do.
To set a program to run as Administrator and in XP Compatibility mode just right click on the file and click on Properties, then click on the Compatibility tab, then check-mark the appropriate boxes and then click OK.
Now tell Device Manager to scan for hardware changes by clicking on the action tab and then choosing "Scan For Hardware Changes".
You should now see your sound card pop up in Device Manager with a yellow exclamation point showing that it needs a driver.
When it ask you for the drivers for the sound card, just point it to the directory where you just unzipped and modified the wdm754_5245.zip drivers.
Do not run setup.exe in the drivers directory to install the drivers! You MUST do the install from Device Manager. If you don't, you will have to uninstall and reinstall from Device Manager in order to get a proper install.
I discovered through the use of the Yamaha Utilities (which you will be installing next) that the driver file YDSXGDK.SYS doesn't automatically install using this install method so I manually moved YDSXGDK.SYS to the Windows System32 and System32\drivers directory so that it shows up as being installed when loading the Yamaha Utilities.
So far I've not noticed any difference this has made, but it must play a role in something or else Yamaha Utilities wouldn't have had it grayed out before and now it is not grayed out. If anyone out there can figure out what exactly YDSXGDK.SYS does and if it's important for anything then please post that info in this thread for the benefit of all reading this guide.
According to a quick Google search YDSXGDK.SYS is "YAMAHA DS-XG Audio Docking Device (WDM)", whatever that means. Was this perhaps some sort of externally connected device that came with some models?
Next download and install "YMF7x4 Utilities 1.0" AKA "Yamaha Utilities". Remember to run it as Administrator and in XP compatibility mode.
The Yamaha Utilities is half in English and half in Japanese, but it is mostly intelligible. Hopefully we can get someone here to translate the Japanese dialogs into English and post pictures of the translations in this thread.
In translating the ReadMe.txt file into English using Google Translate I noticed that it said that for most of the settings to have an effect you would need to reboot, so this is important to remember when using Yamaha Utilities.
Here is a screen-shot of what things should look like if everything is installed properly.
This would also be a good time to download and install "Power YMF" http://www.trancein.com/articles/power-ymf/
Power YMF isn't necessarily needed, but it allows you to tweak your Yamaha sound card even further and it is now freeware, so why not? Even though it says that it will only work up till Windows XP, I was able to install it and use it in Windows 7 32-bit. As usual, run it as Administrator and in XP compatibility mode or it won't work.
Power YMF is necessary if you want your sound card to be able to output at 48000hz instead of just 44100hz. Just make sure the "High Quality 44.1kHz Mode" box is checked in order to enable this feature.
Next you will need a program called PortTalk. DOSBox has to have direct access to the ports on your sound card in order to access the OPL3 chip. From Windows XP onward you can't get direct access to any port with a user-level program without some program such as PortTalk to enable this.
PortTalk can be downloaded here:
With PortTalk you can either set it to allow access to only certain ports by certain programs or you can set it to allow access to all ports by all user-level programs such as DOSBox.
It is safest to only enable limited access to a limited number of ports, but that can get a bit complicated to set up. You can decide for yourself which you would like to do, but for the purposes of this tutorial I will be allowing access to all ports by all programs because that is what is easiest and fool-proof. You can always tweak this setting later once everything is working properly.
To install and use PortTalk, unzip it into a directory and put that directory where you would like the program to be installed. A good location would be C:\porttalk. This makes for easy navigation from a DOS prompt in Windows.
Next, navigate to the PortTalk directory inside of an elevated command prompt. To get an elevated command prompt, just right-click on "Command Prompt" in Windows and choose "Run As Administrator".
Once you have navigated to the PortTalk directory, inside the elevated command prompt, type the following command without the quotes: "allowio /a" and then hit enter. This will install PortTalk and allow access to all ports by user-level programs.
Now reboot and PortTalk should be installed and ready to go.
If you don't like the idea of giving all programs access to all ports then you may want to use a command similar to the following rough example. This would give DOSBox only access to only port 388.
C:\porttalk\AllowIo.exe DOSBox.exe 0x388
Be warned, however, this is a more difficult way to go about things and it may take you a while to get the exact command/s right this way, whereas the previous command is sure to work since it opens up all ports to all programs, but may result in some system instability.
Another (probably better) way to go about this is to open up access to all ports, but only to DOSBox and to no other program. That would look something like this:
C:\porttalk\AllowIo.exe DOSBox.exe /a
Now start DOSBox and on the DOSBox console you should see a message like the following that will let you know that PortTalk is installed and working properly with DOSBox.
Port mappings hardware -> DOSBox:
220 -> 220
221 -> 221
222 -> 222
223 -> 223
228 -> 228
229 -> 229
388 -> 388
389 -> 389
38a -> 38a
38b -> 38b
Next download and install Coolsoft VirtualMIDISynth. This is needed because, from Windows 7 and up, Windows does not include a proper MIDI mapper, or any MIDI mapper at all in later versions of Windows.
A MIDI mapper is needed to tell Windows programs what method to use to play MIDI files by default.
While installation of this program is not absolutely necessary, it does make it much easer in choosing whether you want to use the built in Yamaha DS-XG Synthesizer or to use Soundfont .SF2 files when playing MIDI files, both in-game in DOSBox and out-of-game in Windows.
VirtualMIDISynth can be downloaded here:
Once VirtualMIDISynth is installed, start it up and click on the "MIDI Mapper" tab. Here you can choose "Yamaha DS-XG Synthesizer (WDM)" under the "Default MIDI Out Device". Now anytime you play a MIDI file both in-game and out-of-game, the Yamaha synthesizer will be used instead of the poor quality "Windows GS Wavetable Synth" that comes with Windows.
You can, of course, change this setting to use a soundfont file instead for playing MIDI files and still use the built-in OPL3 for FM synthesis in DOSBox if you like.
Next you will need to know how to set up DOSBox to use hardware passthrough so that it will be able to access your OPL3 chip.
First of all locate your "dosbox.conf" file in order to configure DOSBox. This file can be in different places depending on which version of DOSBox you have installed and how you installed it.
Open "dosbox.conf" in a pure text editor such as Notepad.
Go to the "rate=" section under "[mixer]" and change the setting to rate=41000. The rate= command is only used for PCM sound in DOS games since we are doing hardware OPL3 and all PCM sound rates used in DOS games will evenly divide into 41000. This will keep DOSBox from doing any signal rate conversions which it does very poorly.
Under "[midi]" go to "midiconfig=" and change the setting to midiconfig=0 This will tell DOSBox to use whatever you have set as the "Default MIDI Out Device" in the VirtualMIDISynth MIDI Mapper as the MIDI player in-game.
You can also change this setting to a non-zero number and it will use the MIDI out devices in the order that they show up in VirtualMIDISynth, but I find it easier to leave this setting as 0 and then use VirtualMIDISynth to control the default MIDI Out Device.
If you decide for whatever reason to use DOSBox without VirtualMIDISynth, you can type the following at the command prompt inside of DOSBox and it will tell you what MIDI player is associated with what number so that you can change the midiconfig= number to match the MIDI player that you want.
Now go to the "[sblaster]" section and make sure your settings are set as follows:
The oplmode=hardware is the most important to get right because that is what tells DOSBox to use your hardware OPL3 chip instead of it's own built-in poor quality OPL3 emulation.
The hardwarebase=220 is also very important because that tells DOSBox what IO address your real OPL3 is installed at inside Windows.
Note that irq= may need to be set to 7 instead of 5 for some games. This setting is what IRQ DOSBox tells your game that your sound card is set as. Some games want 7 and some want 5 and some don't really care which of the two that you use.
Now just start up DOSBox and test your favorite game that uses OPL3 FM synthesis to make sure everything is working OK.
Alternatively, you can also use the Diagnose.exe that is included with the "Sound Blaster 16/SB32/AWE32 Basic Disk for DOS" package which can be downloaded here: http://support.creative.com/downloads/downloa … nDownloadId=273
This is the test method that I prefer because it will test for 8bit, 16bit and FM Synthesis. FM Synthesis is the test that will fail if you don't have OPL3 passthrough set up properly. It will also test the left channel and right channel independently to make sure that that is working properly as well.
Diagnose.exe will also serve to initialize legacy FM ports which needs to be done once every time you reboot. Some games will automatically do this when you start them, but some won't, so Diagnose.exe is the surest way to accomplish this.
Just run Diagnose.exe and keep hitting enter until you get to the point to where you test the FM Synthesis "Synthesized Music" and then run that and your ports will be sure to be initialized until your next reboot.
This brings us to the end of this, admittedly, rather long tutorial. If you've made it this far you should be all set to enjoy your real Yamaha OPL3 inside of a modern version of Windows and on modern hardware.
Since this was such a long and complicated guide there may be mistakes or omissions on my part. If anyone notices anything that I've left out or that I need to clarify, please leave a comment below and I will try to fix any problems ASAP.
I would also welcome any comments on how to do any of this better or more efficiently. This is only one way to do this and there may be other ways, and even better ways, to get the same results.
I would now like to thank all of you that have posted on VOGONS and gave me all of the clues that I needed to figure this puzzle out and to piece this guide together for the benefit of all.
In particular I would like to thank VOGONS member Stretch, as his post from the Japanese message board was the final piece of the puzzle that I needed to pull all of this off. Many thanks! 😀
Here is the post from the Japanese message board translated (very poorly) using Google Translate in case any of you are able to glean any more useful information than what I was able to interpret and put into this guide up till now. The more light that can be shed on this subject the better.
I also found this link to be of particular interest that was taken from the above link. It is a Japanese sound card museum with high quality pictures of many sound cards. This is an invaluable resource for finding sound cards by different manufacturers that use the Yamaha YMF7x4 chips that will work with this guide. This link is a goldmine of information:
"There are only 10 types of people in the world; those who understand binary, and those who don't."