VOGONS

Common searches


First post, by DragonSlayer

User metadata
Rank Newbie
Rank
Newbie

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/

DOSBox Megabuild6 will also support OPL3 passthrough. It can be downloaded here: http://home.arcor.de/h-a-l-9000 or here: http://www.adlibtracker.net/downloads.php

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
http://www23.tok2.com/home/muvosquare/test/wdm754_5245.zip

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

http://web.archive.org/web/20030220051100/htt … 1_WDM5245b2.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.

http://www23.tok2.com/home/muvosquare/test/y7x4util10.lzh

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.

http://jisaku.155cm.com/src/1316715272_9cc449 … 9d21b91243a.png

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:
http://retired.beyondlogic.org/porttalk/porttalk.htm

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.

(Example)
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:

(Example)
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:
http://coolsoft.altervista.org/en/virtualmidisynth

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.

mixer /listmidi

Now go to the "[sblaster]" section and make sure your settings are set as follows:

sbtype=sb16
sbbase=220
irq=5
dma=1
hdma=5
sbmixer=true
oplmode=hardware
oplemu=compat
oplrate=49716
hardwarebase=220

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.

https://translate.google.com/translate?hl=en& … /t1&prev=search

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:

http://wavetable.web.fc2.com/sclab/honkan/html/allcards.html

"There are only 10 types of people in the world; those who understand binary, and those who don't."

Reply 1 of 5, by Ponytail

User metadata
Rank Newbie
Rank
Newbie

Your inability to do the OPL passthrough with Dosbox X was due the the fact the author disabled the passthrough in the compiled code. Look into the Dosbox source code for OPL3, enable and recompile the code, the Dosbox X OPL hardware passthrough will work again. Even with a working OPL passthrough, the FM volume within Windows seems to be on the low side. There is no option to raise the volume that I am aware of. If anyone in Vogons can point me in the right direction, it would be most appreciated.

Reply 2 of 5, by DragonSlayer

User metadata
Rank Newbie
Rank
Newbie

I haven't tried to do OPL passthrough on a recent version of Dosbox X. Is it still the case that OPL passthrough is disabled by default unless you do your own code compile? If so, what could possibly be the reason for this? It would seem that this would be an option within the program rather than being completely disabled by default.

"There are only 10 types of people in the world; those who understand binary, and those who don't."

Reply 3 of 5, by Ponytail

User metadata
Rank Newbie
Rank
Newbie

If you would like the version of Dosbox X that already has the OPL3 hardware fixed, I could drop you the files and programs for you to try out. I wrote to the author of Dosbox X sometime back, he said he disabled it due to code compilation errors. If you would like the Dosbox X latest version with working hardware OPL passthrough, you will need to dig into the OPL portion of the codes, enable it and recompile the codes.

Reply 4 of 5, by Ponytail

User metadata
Rank Newbie
Rank
Newbie

There is a specific reason why Dosbox X version maybe the best version for running Dos games. Pixel Perfect, with true hardware OPL passthrough. The only problem I can see is the Yamaha card we are having. Somehow I suspect, the programmers forgot to add FM to the mixer within Windows. Without the mixer option, there is no way to adjust the FM volume within Dosbox-X. I can see maybe 2 ways out of this problem. First, we dig into the registry to change the FM volume (no luck), and the other is to forget about the whole card, use perhaps SB Live, but buy another OPL 3 add on like Retrowave OPL3 with actual hardware volume knob and is supported by Dosbox-X. Option 1 is technically more challenging but it would be the more elegant solution between the two. More wires coming out of the computer case is perhaps the last thing I want on my retro machine. By the way, the card I am using for the project is YMF 744 from Cobra.

Reply 5 of 5, by DragonSlayer

User metadata
Rank Newbie
Rank
Newbie

@Ponytail: Yes, I would definitely like a version of DOSBox-X that does OPL passthrough to play around with someday, but do you think you could post it publicly somehow so that others could also benefit from your efforts? The more people that can get their hands on it, the greater the chance that someone will be able to work out the bugs that you are experiencing. Not only that, but the only versions of DOSBox that officially support OPL passthrough that are publicly available today are very old and are missing features and important bug fixes that would be present in a more modern version of the code.

You must remember that there are very few people out there that are code-savvy enough to get into the source code and reenable this feature for themselves. It's really too bad that the author of DOSBox-X can't be bothered to fix the code for the benefit of everyone, but I can kind of understand since this is a feature that would be used by a very small minority of users. It does seem though that if you were able to compile the code and get it working that the author of DOSBox-X could do the same. Perhaps this was an issue years ago with the code, but has now been fixed, and all it needs is to simply be reenabled in the code so that everyone can benefit.

"There are only 10 types of people in the world; those who understand binary, and those who don't."