MIDI in Linux via Wine and embedded in the browser

Wow, maybe I should start using this blog!  Anyway, here’s a few interesting things to do in Linux if you are still stuck on MIDI.

A few days ago I was thinking about the old days and looking at my old archives of my webpages from 1997 and prior.  Back then one of the cool things we were doing was to embed MIDI sound files into your page so when it opened up in the browser the MIDI would start playing automatically.  It’s still possible to playback embedded MIDI natively on Linux with Firefox.  The basic steps are as follows:

1) Install mozplugger and timidity

1a) You actually need to configure timidity to use proper soundfonts (assuming you don’t have a MIDI board in your computer). I’m not going to go into this since it’s documented very well elsewhere, start here if you are using Ubuntu, but I don’t recommend going too far with that help page. Only the section about “Installing Timidity” is important. There are lots of posts on Ubuntu forums and Linuxquestions forums as well to help you. The key is to get a good sounding set of soundfonts otherwise the instruments sound weird.

1b) I also don’t recommend running Timidity as a daemon on a Linux box that uses Pulseaudio. Use a tool such as sysv-rc-conf to remove it from your runlevels so it doesn’t start with the OS.

2) Edit the file /etc/mozpluggerrc and basically delete everything in that file except type in (or edit) the following:

audio/mid:midi,mid:MIDI audio file
audio/x-mid:midi,mid:MIDI audio file
audio/midi:midi,mid:MIDI audio file
audio/x-midi:midi,mid:MIDI audio file
controls noisy stream: timidity "$file"

Basically what you are doing is to tell mozplugger to act as a Firefox plugin only for MIDI files.

3) Restart Firefox and do about:plugins in the address bar to make sure you see mozplugger acting as the plugin for MIDI files. Navigate to a webpage with an embedded MIDI such as this page and test it out.

4) If it doesn’t work and you don’t see the 3 play buttons and don’t hear the music, download a MIDI from somewhere on the Internet and try to play it like “timidity xxxx” in a shell and see what it spits out.

———————————————————————————————

There are two other really cool MIDI programs that are native to Windows but I figured out a way to get them running via Wine and I just think they are really cool so I wanted to share.  Both of these programs are like “environmental sounds” generators like those old school bedside radios you used to see from Sharper Image or the places in the mall that sell expensive off-beat stuff.

Aire Freshener by Peter Hirschberg

Syntrillium’s Wind Chimes

Apparently Syntrillium was bought out by Adobe and Adobe decided not to proceed with development of most of their software such as Wind Chimes or the venerable Cool Edit Pro that many old school computer geeks will fondly remember.  They also had a lot of other really cool software like screen savers that moved to the rhythm of music and stuff like that.  That was really cutting edge back in the mid-90′s.

In order to run these programs in Linux via Wine it’s not so easy to just install the programs and expect them to work with Wine’s Alsa-Midi device.  At least it didn’t work for me that easy.  What I finally discovered to get these programs to work is to first make Wine to see the Timidity MIDI mappers via Alsa.  In order to accomplish this, I created some simple scripts to load Timidity as an Alsa sequencer and then run the programs with Wine.

Firstly, I recommend installing these programs into their own Wine environment so as to not mess with your existing main Wine directory under /home/xxxx/.wine and to avoid any potential problems. In order to use a special “sandbox” Wine environment you specify the WINEPREFIX environment variable something like this: env WINEPREFIX=/home/xxxx/bin/chimes/ wine setup.exe
That will install the program into a Wine environment in /home/xxxx/bin/chimes/ After you get all this figured out it’s on to making and testing the scripts. Below is my script for the Syntrillium wind chimes program.

#!/bin/bash
timidity -iA & disown
export WINEPREFIX="/home/xxxx/bin/chimes/"
cd /home/xxxx/bin/chimes/drive_c/chimes/
wine ./chimes.exe &
wait
killall timidity

Basically what this does is to start up a Timidity Alsa sequencer, then Wine is called to execute the Windows chimes binary, then Timidity is killed after you close the chimes program. Here is my script for the Aire Freshener program (I didn’t use a special Wine environment for this one).

#!/bin/bash
timidity -iA & disown
cd "/home/xxxx/.wine/drive_c/Program Files/Aire Freshener 2.0/"
wine "Aire Freshener.exe" &
wait
killall timidity

Hope you enjoy some old school MIDI on Linux!

Advertisement
This entry was posted in Audio, Wine and tagged , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s