About SFZ files

What are SFZ files?

As I intend to use the SFZ format for my samples, I would like to explain a little more about this really nice and neat sampled instrument library format.

An SFZ file itself is a text file, separate from the sound samples1 that form the whole instrument. This text file contains instructions on how to use the audio samples. At the basic level, it tells which audio files correspond to which played notes. Other things such as tuning adjustments, ADSRs, filters, and sound behavior at different note velocities can also be encoded in the SFZ file. SFZ is similar to a programming or markup language, wherein special keywords known as “opcodes2” instruct the SFZ player how to play with the samples.

  1. In the context of this article samples are the individual note recordings contained in 1 file, for example a sample can be a file named “piano-c4.wav”.
  2. More about SFZ programming and opcodes here: drealm.info, sfzformat.com, Cakewalk Synthesizers, Sound on Sound.

Software for using SFZs

There are many software that can use SFZ files. However, to take full advantage of the SFZ specification, it is best to use dedicated software that recognize many of the SFZ “opcodes”. Cakewalk, the company that introduced SFZ, should have the best support and they have Dimension and Rapture, among others. Recently, Plogue’s sforzando is gaining popularity because it is free and thus encourages many SFZ developers (including myself). Linux Sampler also looks promising, and seems to be the only native option in Linux. I had tried other software that can load SFZ, such as Beat Zampler and Synthfont. These do not handle SFZ very well as the others mentioned. For example, loops may not be implemented or samples in ogg format are not loaded.

SFZ vs SF2

Before there was SFZ, there was SF2. Although they are very similar in purpose and are interchangeable from a user’s point of view, there are fundamental differences in these formats. A useful analogy to consider is that SFZ uses samples the a way web page (HTML) uses images. SF2 embeds the samples into itself like how a Word document stores images.

SF2’s are binary files that you can’t simply just open with a text editor. There are free SF2 editors out there such as Viena, Polyphone and the SWAMI project. Personally, I find that these GUI programs are a bit complex, i.e. you have to dig in a lot of menus, tabs, dialogues… etc. And do this for each sampled note. SFZ is not necessarily simpler than SF2. But all you need to tweak are presented in one place, a plain text file (with a .sfz extension). As with any text file, SFZ has the convenience of “copy and paste” and “search and replace” as opposed to using hundreds of mouse clicks in an elaborate GUI. Everything important is easily seen or found in the text file as opposed to going to different locations in a GUI.

SFZ uses sample files as they are. Supported files such as wav or ogg (or even flac) remain in some convenient folder. This makes an easy workflow with an audio editor or digital work station. It is also possible to have multiple SFZ files, programmed in different ways share the same sample set. For example, the extended version of my SFZ sustain strings also includes the lite version which uses a memory friendly subset of the same samples. In an SF2 file the samples are also embedded in the file. This is not necessarily bad, but it can be less convenient, especially if there are a lot of audio samples to manage.

SFZ and SF2 have functionalities that can’t be found on the other. This can be expected as they came from different developers; E-Mu and Creative for SF2, and Cakewalk for SFZ. For example, SFZ allows roundrobin, e.g. rotating between different samplesĀ  for a note that is being played repetitively with the same pitch and velocity. SF2 is capable of having multiple instruments stored in one file. Typically, you can find SF2 files that contain all 128 instruments in the General MIDI specification. This is totally different from the SFZ approach wherein external sample files are mapped in the text file.

Since SF2 was introduced at a time that computers are not as powerful as today, many SF2 files tend to be much smaller than SFZ libraries. They’re not necessarily inferior in quality, but some compromises might have been done due to such memory, disk and processing constraints of the past. Today, however, you can find SF2 files that can reach gigabytes, specially if they contain many instruments.


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