Create Your Own Virtual Instruments with SFZ Files

June 4, 2014
share


Above: Four SFZ players, clockwise from lower left: Plogue Sforzando, Cakewalk Dimension Pro, RGC Audio SFZ, and Camel Audio Alchemy Player.

What’s free, cross-platform, and lets you create your own sample- or wavetable-based virtual instrument? The SFZ file format. Originally developed by RGC Audio (often stylized as rgc:audio) it has since provided the basis of sample libraries and instruments from Cakewalk, Camel Audio, Garritan, Impact Soundworks, PatchArena, Plogue, and many others. Free SFZ players, instruments, in-depth documentation, and even a free SFZ file editor (sfZed) are all available online. In addition to the links later in this article, internet searches yield lots of SFZ results.


Overview

Although developed years ago, the SFZ file format is gaining popularity of late. It’s not tied to any particular host, and there are VST, AU, RTAS, AAX, and standalone players for 32- or 64-bit operating systems. You can also load SFZ files into instruments based on the SFZ format, like Garritan’s Aria Player and Cakewalk’s Dimension Pro or Rapture.

What’s in an SFZ instrument? There are two components: 

  • First, a collection of samples (WAV, AIFF, MP3, Ogg Vorbis, or FLAC; stereo or mono; 8/16/24/32-bit resolution; and any sample rate).
  • Second, a text file that specifies how these samples behave. This file maps samples across the keyboard including splits, multisampled velocity splits, and crossfades among layers, but also offers envelopes for pitch/filter/amplifier, filter attributes, LFOs, step sequencing, MIDI controller associations, sync-to-tempo, round-robin sample triggering, key-switching, and much more. Although not all players support all SFZ functions, they support the basics and often quite a bit more.

Writing the text file can be daunting, because it’s sort of like writing computer code—although SFZ files are far simpler. It’s much less scary if you think of the process as simply writing down a synthesizer’s front panel settings using specific abbreviations, like “ampeg_decay=2.5” for “amplitude envelope decay setting of 2.5 seconds.” Of course, SFZ files end with the suffix “.sfz,” which you can edit with any text editor either by specifying a particular program to open SFZ files, or by changing the suffix to “.txt” before commencing editing.

File locations are a critical aspect. The SFZ text file specifies where to find the samples; typically, you’ll either have a folder and place the samples and SFZ file in it (in which case the SFZ file doesn’t need to specify a folder, because it first looks in the folder where it’s located) or create a folder of multisamples, perhaps with folders inside containing groups of samples and SFZ files. The SFZ files reference the folders containing relevant samples. 


Free SFZ Players

There are several free players. Here are some specifics on three of them.

RGC Audio sfz. Available from Cakewalk, sfz has modest memory and CPU requirements. If you just want to load the samples from an SFZ file the same way you’d load SoundFonts, it’s all you need, but the feature set has been eclipsed by the next two players.

Camel Audio Alchemy Player. This not only loads SFZ files, but can modify them with a variety of onscreen controls (their functions can differ for different presets). You can also download a bunch of free samples and instruments that show off the player’s capabilities.

Plogue Sforzando. This is my preferred player for developing SFZ text files, because you can open the text editor from within the player, edit the file, save it, and the player loads any changes instantly (the other players require that you edit, save, and reload the file into the player). Sforzando also supports a wide variety of SFZ opcodes, which gives the most flexibility when writing the text file.


Instrument Creation Tutorial

I’ve created a free, downloadable SFZ instrument for Plogue’s Sforzando player that uses a single sample from Gibson’s EB 5-string bass, and stretches it across the keyboard (note that the SFZ engine has extraordinary fidelity—the higher and lower octaves are free of strange artifacts). CLICK HERE to download it, and follow along.

There are two main types of commands: Region, which does the sample mapping, and Group, which affects the Regions below it (and remains in effect until the next Group command).

Let’s dissect the instrument’s SFZ text file; lines preceded with “//” are comments and do not affect the player. The Region command maps the sample across the keyboard by specifying the sample name (b3.wav), its pitch center, and range from low to high key. The Group commands recognize the sample’s loop point and add a basic amplitude envelope. (If there were additional regions, e.g., from multisampling, after the Group commands, then the Group commands would affect those as well.) With that knowledge under our belts, here’s the code (Note: lines that begin with // are remarks; you do type them in to keep track of where you are, but their presence does not affect the code's operation.)



// SFZ Definition File

// EB 5-string bass


loop_mode=loop_sustain

// The following are amplitude envelope parameters; decay and release are in seconds.

ampeg_decay=1.5

ampeg_sustain=50

ampeg_release=0.05


sample=b3.wav pitch_keycenter=B3 lokey=C0 hikey=C8



Now let’s make this instrument much more interesting with some additional commands that affect two more layers. 



// SFZ Definition File

// Gibson EB 5-string bass with two additional “synth” layers


loop_mode=loop_sustain

ampeg_decay=1.5

ampeg_sustain=50

ampeg_release=.05

// Amp_veltrack defines the velocity curve. 70 raises lower velocities for a more compressed feel. 100 is full dynamics, while 1 is all notes at full velocity.

amp_veltrack=70

// Three stages of EQ are available, with frequency, bandwidth, and gain. This setting boosts the highs so the sound cuts through a mix better.

eq3_freq=2500

eq3_bw=3

eq3_gain=9


sample=b3.wav pitch_keycenter=B3 lokey=C0 hikey=C8


// The second layer starts off similarly to the first layer and points to the same sample, but then adds filtering and other attributes.


loop_mode=loop_sustain

ampeg_decay=1.5

ampeg_sustain=50

ampeg_release=.05

amp_veltrack=90

eq3_freq=2500

eq3_bw=3

eq3_gain=9

// The next eight lines add a 2-pole, resonant lowpass filter with envelope to give more of a synth bass sound.

fil_type=lpf_2p

cutoff=100

fil_keytrack=100

resonance=12

fileg_decay=3

fileg_sustain=50

fileg_release=.05

fileg_depth=5600

// This layer is tuned flat 5 cents, and panned full left.

tune=-5

pan=-100


sample=b3.wav pitch_keycenter=B3 lokey=C0 hikey=C8



There’s one more group/region layer that’s identical to the previous one, but with three changes:


tune=5

pan=100

delay=0.03



Tune is set to five cents sharp, pan is full right, and there’s a 30-millisecond delay—all of these increase the apparent stereo width (however, this patch also works well in mono). Now all you need to do is put the b3.wav sample and SFZ text file in the same folder, and when you drag or import the SFZ file into a player, you can play the bass sound. 


Text File Alternatives

If you don’t want to write a text file to edit parameters, a player like Cakewalk’s Dimension Pro brings out many functions to front panel controls. However note that Dimension Pro is not an SFZ file editor, but an instrument editor. Therefore saving a Dimension Pro instrument does not add these changes to the raw SFZ file, but rather modifies the instrument settings that process the SFZ file on the fly. If you load the SFZ file in a different player, it will not reflect edits you made in Dimension Pro.

Regardless of which player you use, SFZ files provide a free way to map your samples to a keyboard, modify them, and play them back. It’s easy to “reverse engineer” SFZ files if you want to learn more. Why be normal? Make your own sounds!

Show Comments

These are my comments.

Featured

No records found

Reader Poll

Are any of your gigging synths analog?




See results without voting »