Saturday, September 22, 2007

Folk Guitar MIDI: Soundfonts

Midig itself comes with a fairly good acoustic guitar soundfont. However, an even better alternative is available. I use the SampleSmith free soundfont, which I think sounds more like a real guitar. This is available at:

SampleSmith Free Soundfont

The quality of this is excellent and I would recommend buying the full version (especially for just $9.95). However for now our demo can proceed by using the free version. First, we need to update Midig to use a patch that provides for better SF2 support. Make sure you first install the basic Midig 2.03 and the 2.04 update from the home page, then download and install this update over that:

Midig_SoftSynth_205a_update.zip

Next, we need to install this soundfont into Midig. It is possible to add a new instrument to by modifying the GM.DAT file that comes with Midig. First, copy the soundfont file (.SF2 extension) into the SF2 folder within your Midig installation. Then, open up the GM.DAT file, and assign an unused voice number (I used 121) to the soundfont file:

      121 = { "sf2/SampleSmith_Free_G1-v1.sf2", VOL_SF2, 0 }

As with other soundfonts, this contains more than one preset (in this case 2; one is muted, and the other is long rings). This presents a small problem with Midig, as its SF2 support doesn't currently allow for selecting these presets. If you select this instrument using the current version of Midig, you'll only hear the muted voice, not the "long rings" voice we want to play the song with. To solve this problem, it is possible to extract the soundfont into a folder with all of its individual samples extracted into indivdual WAV files, and more importantly, its control structure and WAV mappings into a text file. We can then hand-edit the control file to include just one of the presets, and re-construct it into a smaller soundfont usable by Midig. The program to do this is called SF2COMP and is available at:

SF2COMP Home Page

First, extract the soundfont from its ZIP file and place it into a folder that you've created for this purpose, say c:\sf2. Next, use the SF2COMP program to de-compile the soundfont into its WAV files and into a text file that describes the presents and WAV mappings (we'll call that ss.txt):

c:\sf2>sf2comp d SampleSmith_Free_G1-v1.sf2 ss.txt

Now, copy the mapping text file into a new one that we can hand-edit, we'll call it ss2.txt:

c:\sf2>copy ss.txt ss2.txt

Open this file and find the "presets" area:

[Presets]

PresetName=Open Muted
Bank=1
Program=2

Instrument=Open Muted
L_LowKey=0
L_HighKey=127
L_LowVelocity=0
L_HighVelocity=127


PresetName=Open Long Rings
Bank=1
Program=0

Instrument=Open Long Rings
L_LowKey=0
L_HighKey=127
L_LowVelocity=0
L_HighVelocity=127

Delete the "open muted" preset and just leave the open long rings present:

[Presets]

PresetName=Open Long Rings
Bank=1
Program=0

Instrument=Open Long Rings
L_LowKey=0
L_HighKey=127
L_LowVelocity=0
L_HighVelocity=127

Now re-compile this mapping file into a new soundfont, we'll call it ss2.sf2:

c:\sf2>sf2comp c ss2.txt ss2.sf2

Move this new soundfont file into the SF2 folder within your MIDI installation directory. Finally, modify GM.DAT in the MIDIG directory to point to our modified soundfont:

     121 = { "sf2/ss2.sf2", VOL_SF2, 0 }

That's it! You now have a nice new guitar soundfont to play with in Midig by simply selecting program 121:

V:1 octave=-1
%%MIDI program 121
E/E/ E/E/4E/4|F/E/ D|E/E/4E/4 F/A/|\
...

Here's the result: shady3.mp3

No comments: