Category Archives: MIDI

Improving MIDI Playback in Windows 10 and Firefox

Well, I finally got Firefox to play MIDI files using a Soundfont of my choice. Previously, I showed How to Make MIDI Files Sound Better in Windows 7. Well, this doesn’t work in Windows 10 mainly because Microsoft removed the MIDI Mapper functionality and the MIDI playing plugins that used to work in Firefox no longer do. Anyway, here’s what I did for Windows 10.

First thing in Firefox is to install the MIDI Player extension by Jazz-Soft. Then, install the Jazz-MIDI extension in Firefox. This is all you do with Firefox itself. The next two items are separate programs that run in Windows. You’ll need to restart Firefox after installing the other programs.

The two items are from CoolSoft. The first is their VirtualMIDISynth program which allows you to choose which Soundfont(s) to use and which MIDI device to play through (more on this later). For now, go ahead and install their MIDIMapper plugin. This is the replacement for the removed Windows MIDI Mapper.

Continue reading

Recording MP3 Versions of MIDI Movie Themes

Because Firefox has basically stopped all plugins from working except Flash since version 52 and workarounds failing with version 55 (ugh..), none of my DVD and Blu-ray pages that have an embedded MIDI player using the Microsoft’s Windows Media Player plugin work any longer. So, I decided to record MP3 versions of them which can be played using a standard HTML5 <audio> tag that all modern browsers support.

Audacity and XMPlay

Originally, I used Cool Edit 2000 which I’ve had a licensed copy of for some time. I recorded The Best of Benny Hill theme using it. Since then, I’ve been using Audacity to record the audio while using XMPlay to play the MIDI file. I then exported the audio as a MP3 using the Lame library. I used the Extreme quality preset during the export. So, now on pages like Star Wars IV: A New Hope, there’s a MP3 player as well. Since I’m using the MediaElements.js HTML5 video player on these pages, I decided to their MP3 player also.

Now I need to figure out what I’m going to do with my General MIDI page, if anything. Hmmm… 😖 For now, at least, the Windows Media Player plugin still works in Firefox ESR 52.

How to Make MIDI Files Sound Better in Windows 7

Note (December 29, 2021): For those with Windows 10, please see Improving MIDI Playback in Windows 10 and Firefox.

For those that might remember, my old computer system had a melt-down of sorts and I had to get a new one. This new system has Windows 7 Pro/SP1 64-bit and has a Realtek ALC892 Audio chipset in it. Regular MP3s and other digital music formats sound fine on it but MIDI files sounded like crap for the most part compared to my old system. I do still have the Sound Blaster X-Fi Elite Pro that was in my old system; however, I just never felt like going through the effort of trying to get it to work in this system due to its age and probably limited support in Windows 7 64-bit. Anyway, I knew the problem wasn’t so much the audio chipset (well, yes, it does have an impact) but the lack luster MIDI instrument samples that ship with Windows 7 which the included “Microsoft GS Wavetable Synth” uses. I also looked at the Sound Control Panel Applet and noticed that there was no option to set a default MIDI playback device like Windows XP had (which I still find rather odd.)

So, I went searching on the internet and found an article aptly titled: How to Make Midi Files Sound Better on Windows, which led me to CoolSoft’s VirtualMIDISynth. So I thought I would try it out and, what do you know, it works great! I was even able to load the SoundFont that my Sound Blaster X-Fi Elite Pro was using.

Anyway, since my website uses Windows Media Player to play its MIDI files with, I did need to use this software to change MIDI Mapper’s Default MIDI Out Device from Microsoft GS Wavetable Synth to CoolSoft VirtualMIDISynth:

MIDI Mapper Tab

Then, I loaded up the Soundfont my old card was using in the Soundfonts tab:

Soundfonts Tab

While it doesn’t sound exactly like it did before (due to the differences in audio hardware and drivers), it is now much closer because it is using better base sound samples to work with. MIDI files can sound much different simply by changing the Soundfonts used. I tried a few of the ones linked to at those sites and some of them aren’t too bad. Short of getting a new sound card that puts more emphasis on how MIDI sounds, this is a good compromise, and it’s free! LOL 🙂

Oh, for those using Firefox, the amount of memory that the associated plugin-container.exe process uses while playing a MIDI file will roughly match the size of the Soundfont(s) selected as it has to load them into memory. So, a 256MB Soundfont will cause it to use that much memory.

For those like me that also use Winamp, since the default device has now been changed for all of Windows, it will start playing MIDI files using the improved instrument sounds as well. However, you can directly change the MIDI playback device by going into Winamp’s Preferences -> Plug-ins -> Input -> Nullsoft MIDI Player -> Devices Tab and select the second midiOut / Microsoft MIDI Mapper choice (this is the one that came with Winamp v5.63):

Winamp MIDI Device Setting

Note: If you change the default MIDI Mapper device back to Microsoft GS Wavetable Synth in the VirtualMIDISynth Configurator then Winamp will show two entries for midiOut / Microsoft GS Wavetable. In this scenario, pick the second one. Why it doesn’t list VirtualMIDISynth specifically I do not know. I may send feedback to Coolsoft and/or Winamp about it.

Just for the heck of it, I swapped out Winamp’s current MIDI plug-in with a really old one that supported auto-loading Soundfonts. Its device listing is somewhat different and lists VirtualMIDISynth by name:

Winamp MIDI v2.63b Device Setting

I tried the auto-load Soundfont option that this plug-in has for MIDI files that use a specific Soundfont; however, it didn’t work. Pretty sure that option only works with Sound Blasters (this did work in my old system).

Anyway, I’m still playing with different Soundfonts to get the best sound. Now I need to install a virtual MIDI keyboard so I can play specific instruments. Hope this information helps someone out there. 🙂

Updated MIDI embedding method on DVD pages.

I’ve updated the method I’m using to embed MIDI files in my DVD pages that had them. A couple of example pages are The Best of Benny Hill and Star Wars I: The Phantom Menace. I am using the JavaScript method that is described at MIDKar.com. It’s basically the same thing I was doing before directly within the page’s code without JavaScript; however, this script now adjusts the code based upon the browser it detects which should make it more compatible.  I did modify their code slightly by adding an optional autostart parameter with a default value of 0 if no value is given so that it does not automatically start playing.  Here’s my modified code:

// This script determines correct code required to embed MEDIA files
// for a large number of browsers, including AOL and WebTV
// Windows Media Player is required and always used, except for WebTV
// Written by Les Gorven, http://midistudio.com/
// Ver. 4.0 (simple) auto-start parameter is true - Created: February 2, 2008
// autostart parameter added by Mark Headrick December 2, 2009

function playMedia(mediaURL,rpt,height,width,autostart) {
var mediaURL,rpt,height,width,autostart;

if (typeof autostart == "undefined") {
   autostart = 0;
}

if (GetBrowser() == "IE")
   playAll(mediaURL,rpt,height,width,autostart) ;  
else if (GetBrowser() == "unknown")
   embedSource(mediaURL,rpt,height,width,autostart) ;
else if (navigator.appName.substring(0,5) == "WebTV")
   embedSource(mediaURL,rpt,height,width,autostart) ;
else
   playAll(mediaURL,rpt,height,width,autostart) ;
}

function embedSource(mediaURL,rpt,height,width,autostart) {

   var CodeGen = "";
   var mediaURL,rpt,height,width,autostart;
         
   CodeGen = '<embed src="' + mediaURL + '"' + '\n' ;
   if (autostart == 0) {
      CodeGen += ' height=' + height + ' width=' + width + ' autostart="false"' + '\n';
   } else {
      CodeGen += ' height=' + height + ' width=' + width + ' autostart="true"' + '\n';
   }
   CodeGen += ' LOOP=' + rpt + '>';
   document.write(CodeGen);
}

function playAll(mediaURL,rpt,height,width,autostart) {
   var CodeGen = "";

   CodeGen = '<embed type="application/x-mplayer2" ' + '\n' ;
   CodeGen += ' pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" ' + '\n' ;
   CodeGen += 'Name="Player" ' + 'src="' + mediaURL + '" ' + '\n' ;
   CodeGen += 'autoStart=' + autostart + ' ' ;
   if ((height == 24) && (width == 299))
      CodeGen = CodeGen + 'ShowStatusBar=1 ';
   if ((height >= 50) && (height <= 75) && (width >= 200))
      CodeGen = CodeGen + 'ShowStatusBar=1 ';
   if ((height > 75) && (width >= 200))
      CodeGen = CodeGen + 'ShowStatusBar=0 ';
   if ((height <= 49) && (width != 299))
      CodeGen += 'ShowStatusBar=0 ';
   CodeGen += 'enableContextMenu=1 cache=0' + '\n' ;
   CodeGen += 'playCount=' + rpt + ' ' ;
   CodeGen += 'volume=-1 ' ;
   CodeGen += 'HEIGHT=' + height + ' WIDTH=' + width + '>' ;
   document.write(CodeGen);
}

function GetBrowser()
{
   var agt=navigator.userAgent.toLowerCase();
   if( ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) )
       return "IE";
   else if( ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
         && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
         && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)) )
       return "Netscape";
   else
       return "unknown";
}

Within the page itself, I just put the following where I want the player to appear:

   <script type="text/javascript">
   playMedia("/midi/SomeFileToPlay.mid",3,65,300)
   </script>

If I want the song to automatically start playing, then I would change the code to:

   <script type="text/javascript">
   playMedia("/midi/SomeFileToPlay.mid",3,65,300,1)
   </script>

Seems to work well in both Firefox 3.5.5 and Internet Explorer 8. 🙂

Has hell frozen over? Website no longer using frames!

I have finally done it!!! My website is no longer using frames after years and years. It’s now using a combination of CSS and DIV containers to control the layout. I think I have made changes to all the pages and scripts that I needed to LOL. As you’ll notice, I no longer have my embedded midi player on the bottom left. Instead when clicking on a link to play a random midi file or any particular one, it will open a pop-up window with the midi player. Any future midi files will be targeted to that same pop-up window and start playing.

As a result of this, I have had to modify my .htaccess file to redirect any links that might be going to my old index.shtml (the file that contained my frame information) or main.php (which was the home page file loaded into the right-hand side) to just the root at “/” so that it loads the new index.php.

The main thing that is bugging me so far is that with Firefox, the pages that have an embedded object such as a media player, flash player, or YouTube player causes the left menu to be redrawn… except for the NASCAR page for some reason Confused. In IE, this does not happen. Trying to make things behave the same or as close to possibly can be a real pain sometimes. Anyway, now my website will be easier for search bots to handle and for people to bookmark and refresh pages! Big Grin