An unofficial introduction to soundfonts
It may be weird to be discussing this article after having gone through more advanced topics before. But then again, the purpose of this blog is to inform people, especially the beginners. I have side tracked a bit as other related topics of interest come and go. Since I had temporarily run out of such topics, I now return to the purpose of establishing this blog. Hence, I will be discussing something quite elementary. Soundfonts.
Soundfonts are called soundfonts in analogy with word processor (type setting) fonts. It is helpful to think of them as virtual instruments –musical instruments that exist in your hard drive (this is the future! :D ). Soundfont files commonly have the extension sf2. Just as you can change the fonts in a document or web page, you can also change the instrument for a given piece of music (e.g. piano to guitar). But you can go further by specifying a specific instrument (e.g. Fender Stratocaster to Ibanez Jem). Soundfonts enable you to do such changes digitally. For example, soundfonts can be used to go beyond the usual limitation of having cheesy sounds unfairly associated with MIDI.
The soundfont technology was developed by Creative back in the 90’s.
Usage of the term soundfont
Although it may be more correct to use the term “sample library” as a general term, the term soundfont seems to be frequently used even for other similar non sf2 formats all around the internet. The term “sample“, on the other hand, could be ambiguous as it may also include melodic more-than-one note sound segments intended for quick “copy paste” or remix music.
Back when memory was expensive synthesizers were used to electronically produce different instrument sounds. Doing so relied on real time processing which is also expensive back then. In short, there were a lot of technical constraints that prevented the production of realistic instrument sounds. Eventually, memory became large enough to store samples of recorded sounds, offering more realism over synthesized sounds. (Analog/digital audio synthesis still remains an important sound production tool by itself, producing new and interesting sounds that have their own appeal.)
What are all those Creative Soundblaster stuff?
Soundfonts had been around since the mid 90’s when computer RAM was not as big as we have these days. Hence special soundcards such as the Soundblaster AWE32 loaded soundfonts in their dedicated memory. The memory of these soundcards were still not so much in today’s standards, hence many old soundfonts were made as small as possible. Today, computers with at least 2GB of RAM are quite common allowing soundfonts to be used regardless of what soundcard model is equipped in your PC. In some cases, a soundcard is not even needed. This is particularly beneficial for laptops where you have little control over the shipped soundcard.
Based on my experience (and bias), if I would suggest a newbie, the easiest way to use soundfonts in Windows is to use Synthfont. But that is for the purpose of converting a MIDI file to an audio file such as wav, flac or mp3. Some programs that use soundfonts are meant for other uses which I will list below:
- Converting MIDI to audio formats such as MP3
- Playing a MIDI device connected to your computer:
- Also DAWs with MIDI capability, but that may be overkill for just leisurely playing an instrument
- Playing MIDI files without converting them
- Overriding Windows cheesy GM.DLS sounds: BASSMIDI
If I remember correctly I first learned about soundfonts through a 2009 example in youtube that uses Winamp. Other hints I found when figuring out how to use soundfonts was to use timidity++ or fluidsynth. However, I was not yet so soundfont-savvy back then so I failed to learn them. I was already using synthfont by the time I noticed timidity++’s Windows port, twsynth, and I also already configured VLC media player to play MIDI files by using the fluidsynth library and a multi-instrument soundfont. I eventually learned that soundfonts are widely used with DAWs. But at first I only knew about LMMS which crashes a lot, ruining the musical and learning experience.
How are soundfonts created
Creating soundfonts would be a big jump for someone who has just started to learn using soundfonts. But it doesn’t hurt understanding how they are made, and it would also allow you to use them better. If you can, it can be very rewarding, even profitable. However, before you can create soundfonts, you should first know how to sample an instrument. Sampling involves recording individual notes, then mapping them based on their pitches (this is an oversimplified description).
Assuming you already have a set of instrument samples, SF2 files can be created using Viena (the only existing free program I know). Traditionally, soundfonts were made with Creative’s Vienna (note the spelling differences). But I’m not sure whether Vienna is free, and all those soundcard hardware requirements are only confusing. One caveat is that the SF2 file format is gradually being superseded by other formats with more features such as the SFZ format which is much easier to create.
Is bigger better?
1. Timbre is independent of size
Audio quality is often technically defined as resolution (bitrate and sampling rate). But a real instrument’s quality is determined by its timbre. One could sample a cheap guitar at 32bit and 98kHz, but that does not necessarily make it better than a more expensive instrument sampled at half the bit and sample rate. One could sample all the white keys of a cheap piano and end up with a larger file as opposed to a Yamaha/Kawai/Steinway/Bösendorfer with just three samples per octave. The sampling hardware and environment, i.e. the recording setup, will also affect the final sound. And if recorded properly, cheap instruments may actually sound better! Hence numbers alone are not enough, and you should just let your ear decide which timbre or tone sounds better. As an example, one soundfont I like that is surprisingly small is Cohen’s Alto Sax. The Jazz Page also contains good sounding small sized soundfonts. Of course timbre preference is complex and subjective and those are based on my preferences and biases. You should not just blindly imitate them. In fact, I still change soundfonts/VSTi’s for a given instrument from project to project as some of them seem to blend better with others.
2. More samples are needed for more realism
A single acoustic instrument can produce infinitely many uniquely sounding notes. Even the same note can be played in many different ways. And even if the same note is played in the same way, subtle differences will still manifest as you would see if you compare the waveforms of the recorded samples. Taking these variations into consideration requires the use of multiple samples for the same note or pitch. The following are common categories for mapping out the possible unique sounds of a given instrument pitch.
- Velocity layers. In music notation terms there is piano, forte and their variants are somewhat related to playing velocity. In a real instrument, velocity has more subtle effects than just changing the volume. A piano, for example, will sound brighter when the keys are depressed faster. Many free soundfonts, however, do away without velocity layers.
- Articulations. Articulations emulate the musicians playing techniques. For example, a note plucked on a guitar will sound different whether or not it has a vibrato. The violins and its relatives in the string section of the orchestra also have many articulations such as bowed (arco) and plucked (pizzicato).
- Variations. Even when playing a note at the same velocity and articulation in a real acoustic instrument, it is rare, if not impossible, to produce notes that sound exactly the same. What makes human playing human is the imperfections, subtle randomness and variations. Hence high quality libraries systematically swap different recordings for the same note, a process known as round robin. One of round robin’s benefits is the prevention of the so called “machine gun” effect that happens when the same note repeated in fast succession sounds strangely artificial, breaking the illusion of realism (like in an obviously repeated segment in a dance remix).
3. Multiple instruments in one file
Some soundfonts contain multiple instruments bundled into one file. Common example are GM (General MIDI) collections and orchestral soundfonts. They may appear big, but the individual instruments contained could be over optimized, possibly having less quality than a single-instrument file. Besides, it is usually better to be picky with each individual instrument you use. Bundled GM soundfonts don’t offer variety and might be shipped with a lot of filler stuff you’ll never use. Nonetheless, some applications such as VLC media player and MuseScore can only use one soundfont for all instruments (underneath, they both use fluidsynth).
Other sample library formats
Having been around for decades, it is understandable why SF2 is automatically implied by the term soundfont (a relationship similar to bitmap and bmp). But today, the SF2 format is only one of the many sample library formats. Many new formats take advantage of the increased computing power not available in the days of SF2. Since some are not directly usable or not 100% compatible to some DAWs a sampler/sample player VST is needed to use them.
- SFZ. Introduced by Cakewalk. Use Cakewalk’s sfz player or Plogue’s sforzando. It is easily constructed requiring only the wav sample files “as is” and a text file containing definitions and instructions on how the wav samples are used.
- GIG. Tascam’s Gigasampler. The Linux Sampler (also available for Windows) is originally built for this format.
- DLS. You may not be aware of it, but if you play a MIDI file in a Windows computer, what you hear, by default, is based on the gm.dls file.
- Formats that require a commercial/proprietary player (consequently I’m least familiar with).
Where to get soundfonts
There are a lot of soundfonts available in the internet so using a search engine is probably the most practical way of getting them. Listed below are a few websites that contain lists and links to soundfonts.
- KVR Audio’s Samples. Sampling and Sample libraries forum
- Synthfont’s links to soundfonts
- RK Hive
You can find more orchestral instruments on my dedicated and updated list of free orchestral sample libraries (sf2, sfz, etc).
Why should a beginner care about such things as legal issues? Can’t we just download and enjoy everything the internet has to give?
It’s up to you. I’ll just state what I think about it. The remainder of this article may be optional.
If you care about the legality of your project, then you should be careful that the soundfonts you use are not a rip-offs of a commercial (or even free, yet uncredited) soundfont. This is likely to happen with “repackaged” soundfonts built from multiple sources. Sometimes people will make a smaller version of a large soundfont or modify it in other ways, then distribute it. Doing so might violate the original creator’s copy right terms. For example, the Squidfont Orchestral soundfont is said to be a rip off of Miroslav Philharmonik.
Even worst, some shady “companies” will rip off others’ hard work and profit from it. Such ripping off had happened to the Sonatina Symphonic Orchestra. Although it rarely happens (or is rarely reported :( ), buying does not necessarily ensure that you’re getting clean legal guilt-free stuff. Hence, it is best to check your sources especially if you want to share or sell it to others.