Obsolete: Enhanced ScummVM MIDI music on Windows

Ask for help with ScummVM problems

Moderator: ScummVM Team

User avatar
raina
Posts: 237
Joined: Thu Jan 12, 2006 12:31 pm
Location: Oulu, Finland
Contact:

Obsolete: Enhanced ScummVM MIDI music on Windows

Post by raina »

Enhanced ScummVM MIDI music on Windows
Without the need for SoundFont compatible hardware

This guide is obsolete for ScummVM since FluidSynth's inclusion in the Windows builds. Still works though, especially for other apps and games. :)

NOTICE!: (please read this first)
  • This guide now covers Windows XP and Vista but it should also work on previous versions of Windows. Just let me know and we can confirm this. Also, if you've got suggestions or if you need help, just reply on this thread!

    The guide deals with installing a virtual device driver and to pull that off successfully, you require administrator level access to your Windows system. Proceeding with the steps without it does no good.

    Also, you are expected to be familiar with things like downloading and running an application, extracting compressed archives and deleting and renaming files, otherwise you might get stuck in details I might have overlooked.
Introduction
  • See TODO.
Alright, let us begin..
  1. Installing MIDI loopback
    First we need to download and install the MIDI Yoke patch cable driver. This will take MIDI music data sent from ScummVM (or any other app) and loop it back to Windows so that we may route it further. Here are direct links to the NT/2000/XP versions: Complete the installation by running the installer or following the instructions and finish it by restarting the computer when prompted. If you're running Windows Vista, skip to step 3.
  2. Enabling MIDI loopback
    Check that MIDI Yoke is properly installed by opening
    • Control Panel
      • > Sound and Audio Devices
        • > Audio
    and confirming that MIDI Yoke ports appear on MIDI music playback device list.

    For now, select Out To MIDI Yoke: 1. You may now skip to step 4.

    (You can change back to regular Windows MIDI without uninstalling MIDI Yoke by selecting Microsoft GS Wavetable SW Synth.)

    Image
  3. Enabling MIDI loopback on Vista
    For whatever reason, the audio and MIDI device control panel has been scrapped in Windows Vista, so you need a 3rd party tool for changing your default MIDI device. :roll:

    Joseph Cox's Vista MIDI Picker should get the job done. No installation is required but you may want to hold on to the app for obvious reasons. Run Vista MIDI Picker.exe and select Out To MIDI Yoke: 1 as your MIDI Output Device. Hit Save and on to the next step.

    (You can change back to regular Windows MIDI without uninstalling MIDI Yoke by selecting Microsoft GS Wavetable SW Synth.)

    Image
  4. Obtaining a software synthesizer
    Next we need a software synthesizer to play the MIDI music sent from ScummVM. I've found rgc:audio sfz to be a most wonderful, no-nonsense kind of solution. It's free, simple and small. If you open the folder where you just installed sfz, you'll find it's extensively documented should you need to tweak the settings for better performance or whatever.

    Now, the unfortunate extra step. If you have an ASIO soundcard, you may skip to straight to step 6. ASIO is a low-latency audio protocol available in professional or prosumer soundcards or through special third party drivers and if you didn't already know that and/or you haven't heard of ASIO before, it's pretty safe to assume you don't have it. So step 5 it is for you. :)
  5. Setting up synthesizer I/O (consumer hardware)
    You need SAVIHost to run sfz and you can either get: Pick any one and extract the files to the same folder where you installed sfz.

    The synthesizer part of sfz is actually fully contained in the file called sfz.dll and it's meant to be used inside music sequencer applications (=hosts) as a plug-in. The sfz.exe is a primitive host application that enables sfz to function as if standalone, but sadly it only provides ASIO audio output. Since we are in step 5, we don't have ASIO, thus we don't have need for said sfz.exe. Therefore,
    • delete sfz.exe
    The savihost.exe we just extracted is a replacement for the original sfz.exe with the difference that it also works with standard WaveOut and DirectSound output. And to make it recognize the core sfz.dll and to fully replace the old sfz.exe,
    • rename savihost.exe to sfz.exe
    Now, double-click your new sfz.exe to run it. I know, a lot of buttons and stuff but most of it is not needed. In fact, you can hide all the toolbars from the View menu - they are not needed. At this point we're just going to set up the devices, and memorize how to load and save settings in SAVIHost because after we're done with this step, the instructions are going to focus on the sfz core, not the host app.

    Image

    Open Devices
    • > MIDI...
    For your Input Port, select the MIDI Yoke input with the number that corresponds to the output number selected earlier in Windows Audio settings. In this case, In From MIDI Yoke: 1. There's no need to pass on through, Output Port may remain * No MIDI *.

    Image

    For Devices
    • > Wave...
    The default settings should do fine - Input is not needed, MME: Microsoft Sound Mapper points to your default Output device, you can increase sample rate (if CD-quality is not enough) and buffer size (if the sound is crackling).

    Image

    When we later discuss saving and loading sfz settings, the PlugIn menu is where you find the Load..., Save and Save As... commands. The next step discusses the same issues as this one but is written for the original sfz.exe. You may now skip to step 7.
  6. Setting up synthesizer I/O (ASIO hardware)
    Double-click sfz.exe to run it. At this point we're just going to set up the devices, and memorize how to load and save settings because after we're done with this step, the instructions are going to focus on the sfz core, not the host app.

    Image

    The configuration is straightforward: From MIDI, select the MIDI Yoke input with the number that corresponds to the output number selected earlier in Windows Audio settings. In this case, In From MIDI Yoke: 1.

    Image

    For ASIO device and its Outputs, you probably know best yourself. ;) The ASIO menu also lets you launch your driver's ASIO control panel for setting sample rates, buffer sizes etc.

    When we later discuss saving and loading sfz settings, the File menu is where you find the Load Program (.fxp) and Save Program (.fxp) commands.
  7. Sounds for your synth
    Next we need a SoundFont or several to finally turn the MIDI data flow into audible music and to have some options to better suit different ScummVM games. SoundFont is basically a sound file with musical properties making them more complex than your plain .wav or .mp3. Regardless, the Internet is full of them, free and commercial. But what you're looking for is not the most specialized or original sounds but rather a solid, well-rounded, full General MIDI bank. That way you're prepared for whatever those crazy adventure game music composers had in mind when they decided to use a particular instrument patch and hopefully do justice to the original composition. I've picked two here for you to try out but nothing is stopping you from finding more - or replying and telling the rest of us about them for that matter.
    • Chorium Revision A ~27.5MB, small, cute and a very good GM SoundFont for its size. Direct download, RAR archive. No website, author welcomes suggestions and bug-reports to openwrld (at) kebi (dot) com.
    • SGM-V2.01 ~235MB, I generally prefer the sound of this one over Chorium but it depends on the game. You can get it from the website at http://www.geocities.jp/shansoundfont/ but since the actual download is hosted on an annoying waiting site and the SoundFont requires special sfArk extraction, I took the liberty of mirroring the plain .sf2 file here, just to make things a little simpler. If you don't agree of my actions, by all means, go the official route.
    I thought I could make a point about the CPU usage of these SoundFonts where Chorium would have stood out being less of a hog but a quick test seemed to indicate they're pretty much neck and neck here. So, let's base the recommendations on your Internet connection speed. If you have a thin tube, get Chorium, which is roughly 10% of SGM's size. If you've got the bandwidth, get both so that you already have two options from which to choose when you start another classic adventure game.

    Download the GM SoundFont of your choice and extract it to a folder, any folder. No harm in putting it where sfz itself is either.
  8. Loading the sounds into the synth
    Now, let us assume you have your sfz.exe running and the UI looks like this:

    Image

    You can now drag and drop your SoundFont into sfz, or click the empty box next to FILE > to open the file selector. When a SoundFont is loaded, its file name will show in the currently empty box. Now, the last thing standing between enjoyable game music and crapfest is setting the MIDI drum channel. (If you don't do this, all the drum hits will be played with a piano sound). MIDI drums are generally played on channel 10 and that seems to hold true for BaSS and some LEC games I tried just now. So you first need to
    • Select CHANNEL > 10
    Then assign the SoundFont drum bank to this channel. The drums are usually lurking around bank 127 or 128, it depends on the SoundFont a little. So
    • Select BANK > 127
    and you should be done. You can now save sfz settings to save you a little trouble the next time you're using this setup. Just load the settings and you should be ready to go.

    The rest of the settings you may optimally leave alone. If you're experiencing performance issues, running low on RAM or CPU, consult the sfzfaq.htm bundled with sfz. It gives valuable pointers on the MODE, QUALITY, EFFECTS and POLY settings.
  9. Ready to rock
    The setup is now ready. You just need to edit your ScummVM game settings to use Windows MIDI as the Music driver before starting to play. Just to recap, a working path to enhanced ScummVM MIDI music on Windows is as follows:
    • ScummVM > Windows MIDI > MIDI Yoke > (SAVIHost) > sfz > SoundFont
    Image
There, hope it works for you as both the ASIO and SAVIHost routes work for me. Once more, I'll be watching this thread for comments, trying to help out with problems and updating the guide if needed.



Demos: Tips:
  • See TODO.
Known issues:
  • Day of the Tentacle: Distorted sound in the Chron-O-John cutscene.
Good to know:
  • To quickly reset the SoundFont (in case notes appear stuck for one reason or another), just click the > next to FILE in sfz and reselect the file.
Thanks:
  • chrisis for helping extend the guide to Windows Vista.
Changes:
  • 6.8.2010: Images hosted on a new server
TODO:
  • Introduction, what's the point of this guide? Who is it written for? Why choose this over plain Windows MIDI or Adlib/MT-32 emulation?
  • Tips on SoundFont settings an such. Contributions also accepted.
  • Probably countless little edits.
Last edited by raina on Mon Jan 10, 2011 12:10 am, edited 12 times in total.
User avatar
md5
ScummVM Developer
Posts: 2250
Joined: Thu Nov 03, 2005 9:31 pm
Location: Athens, Greece

Post by md5 »

Fantastic guide! Thanks :)
Queseuq
Posts: 10
Joined: Thu Sep 18, 2008 12:29 am

Post by Queseuq »

Thanks for the guide, really easy to follow and it all works perfectly!
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

I took the liberty of fixing the formatting of this guide (some list item tags where swapped with size tags, making more of the text "large" than apparently intended; also inserted some extra newlines).

Anyway, looks useful, I'll make it sticky :)
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

P.S.: All in all, I do wonder how this compares to just using the built-in fluidsynth software synthesizer + sound font (assuming the Windows port *does* use fluidsynth).
chrisis
Posts: 150
Joined: Sun Oct 30, 2005 4:06 pm
Location: Austria

Windows Vista

Post by chrisis »

Hello, just want to tell, it works in Vista too, really great guide!

But there is one additional step required, by downloading a simple tool.

The problem is, there is no control panel for sound and audio devices in stupid Vista, so you can't choose MIDI Yoke and crappy MS Wavetable synth stays active.

The solution I found via quick googling was downloading a small freeware tool from http://putzlowitsch.de/wp-content/uploa ... r_0_92.zip
Just extract it to \windows\system32 and after a reboot you will find it in your control panel under "Putzlowitschs Vista MIDIMapper" (funny name, I know :)).

The tool is in german, but it's easy enough to understand (it's just one little screen) - under "Standardgeräte" just choose "Out to MIDI Yoke: 1", press OK, and you're done. This actually replaces step 2 of the guide for Windows XP!

Maybe something similiar exists in English too, but since this works for me, I didn't bother to try something else.

So, thanks again for your great guide, and everyone using vista, try it :-), it works with a little bit of tweaking ;-)

cu
chrisis
Last edited by chrisis on Fri Sep 26, 2008 2:24 pm, edited 1 time in total.
chrisis
Posts: 150
Joined: Sun Oct 30, 2005 4:06 pm
Location: Austria

Post by chrisis »

fingolfin wrote:P.S.: All in all, I do wonder how this compares to just using the built-in fluidsynth software synthesizer + sound font (assuming the Windows port *does* use fluidsynth).
no, it doesn't...
User avatar
MusicallyInspired
Posts: 1138
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

Post by MusicallyInspired »

So the already integrated SoundFont portion of ScummVM requires a SoundFont-compatible sound card? Does the SoundFont portion of ScummVM not play the SoundFont virtually within ScummVM? I thought that was the case. If not this guide is indeed handy.
chrisis
Posts: 150
Joined: Sun Oct 30, 2005 4:06 pm
Location: Austria

Post by chrisis »

Afaik (please correct me, if I'm wrong), the built in soundfont menu only works in connection with fluidsynth, and again afaik the only build where fluidsynth is regularly compiled in is the Mac OS port (and maybe some unix/linux ports).
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3558
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

chrisis wrote:Afaik (please correct me, if I'm wrong), the built in soundfont menu only works in connection with fluidsynth, and again afaik the only build where fluidsynth is regularly compiled in is the Mac OS port (and maybe some unix/linux ports).
I think one of the OS X MIDI drivers uses the SoundFont setting. I don't know if FluidSynth works under OS X; I mostly had Linux in mind when I added that sound driver, because I figured native MIDI was least likely to be supported there. (Though it works fine with my sound card, so I almost never use FluidSynth myself.)
User avatar
raina
Posts: 237
Joined: Thu Jan 12, 2006 12:31 pm
Location: Oulu, Finland
Contact:

Post by raina »

Thanks for the positive feedback, especially:

Queseuq, great, that's what I wanted to hear!

fingolfin, for a while there I thought this would sink to the depths of the forum never to be found again. And about the formatting, I tried to keep track but I guess some edits weren't all that successful in that sense.

chrisis, nice investigative work there. Now, if we could find an English component to drop in there, I could include it as another crossroads in the guide.
chrisis wrote:
fingolfin wrote:P.S.: All in all, I do wonder how this compares to just using the built-in fluidsynth software synthesizer + sound font (assuming the Windows port *does* use fluidsynth).
no, it doesn't...
And that's exactly the point of the guide. It would be covered in the Introduction section but as I predicted the guide itself would be relatively tedious to write, I cut to the chase and just added that subtitle there. I've seen several forum posts about the issue (how to make ScummVM games sound more like the mp3s downloadable from x) and I figured many users have the combo of a Windows OS and a sound card or chip which doesn't enable the use of SoundFonts. Since I had a solution around this, albeit a lengthy one, I thought what the hell, let's spread the love.
chrisis
Posts: 150
Joined: Sun Oct 30, 2005 4:06 pm
Location: Austria

Post by chrisis »

raina: I found the following tool, it's advertised to do the same as the one I downloaded, although I haven't tried it. http://www.vista-files.org/programs/jos ... icker.html


But also, the German in "Putzlowitschs Vista-MIDIMapper" is not really that hard to understand, basically it's just there to choose the correct device, just look at the screenshot:
Image
Image
(and no, I have no connections to the author, I just found that tool myself today)
But to link to the article (in german!) just go to http://akkordwechsel.de/15-windows-vist ... di-mapper/

edit: changed screenshot to my own and uploaded to imageshack to save the author's bandwidth
Last edited by chrisis on Fri Sep 26, 2008 7:23 pm, edited 2 times in total.
User avatar
raina
Posts: 237
Joined: Thu Jan 12, 2006 12:31 pm
Location: Oulu, Finland
Contact:

Post by raina »

Well, that looks simple enough indeed. :) I guess I'll update the guide over the weekend.
User avatar
clone2727
Retired
Posts: 1611
Joined: Fri Jun 09, 2006 8:23 pm
Location: NJ, USA

Post by clone2727 »

eriktorbjorn wrote:I think one of the OS X MIDI drivers uses the SoundFont setting. I don't know if FluidSynth works under OS X; I mostly had Linux in mind when I added that sound driver, because I figured native MIDI was least likely to be supported there. (Though it works fine with my sound card, so I almost never use FluidSynth myself.)
AFAIK, FluidSynth on Mac OS X just uses CoreAudio.
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

clone2727 wrote:
eriktorbjorn wrote:I think one of the OS X MIDI drivers uses the SoundFont setting. I don't know if FluidSynth works under OS X; I mostly had Linux in mind when I added that sound driver, because I figured native MIDI was least likely to be supported there. (Though it works fine with my sound card, so I almost never use FluidSynth myself.)
AFAIK, FluidSynth on Mac OS X just uses CoreAudio.
Of course it has to output the sound samples it generates somehow, which eventually means going through CoreAudio, no matter what sound API it does use (I never looked at fluidsynth, so I can't say how it works on OS X, but that's not very relevant, I guess ;).

But just to get this clear: The soundfont setting in ScummVM was first introduce for Mac OS X (namely the "coreaudio" driver, which uses it) exclusively, and only later other midi drivers in ScummVM (i.e., the fluidsynth driver) added support for it, too. But those two are independent, and not to be confused: Selectign "coreaudio" + soundfont is not the same as "fluidsynth" + soundfont.
Post Reply