An SFZ file is divided into sections by headers written in angle brackets. These notes are in our words, from the header pages of sfzformat.com (docs/headers/, the sfz-format repository), the rgc:audio page of 2007 that first described SFZ 1, the LinuxSampler SFZ page and the sfizz source (Synth.cpp, Parser.cpp). The table of headers is the sfz-format repository’s data/sfz/syntax.yml (9 headers).
The nine headers
| Header | Version | Place | What it is |
|---|---|---|---|
<region> | SFZ 1 | lowest level of the hierarchy | “The basic component of an instrument. An instrument is defined by one or more regions.” |
<group> | SFZ 1 | above regions | “Multiple regions can be arranged in a group. Groups allow entering common parameters for multiple regions.” |
<global> | SFZ 2 | top of the hierarchy | “Allows entering parameters which are common for all regions.” |
<master> | ARIA | between global and group | “An intermediate level in the header hierarchy, between global and group.” |
<control> | SFZ 2 | outside the hierarchy, at the start | Special directives for the whole instrument: the sample folder, note offsets, controller labels and start values. |
<curve> | SFZ 2 | outside the hierarchy, usually at the end | “A header for defining curves for MIDI CC controls.” |
<effect> | SFZ 2 | outside the hierarchy | “SFZ v2 header for effects controls.” |
<midi> | ARIA, deprecated | outside the hierarchy | An ARIA extension for MIDI pre-processor effects; from ARIA 1.0.8.0 an <effect> with bus=midi can be used instead. |
<sample> | SFZ 2 | outside the hierarchy | “Allows to embed sample data directly in SFZ files (Rapture).” |
The versions are those of the sfz-format table (Versions says what they mean). The original rgc:audio page of 2007 describes only <region> and <group>; the LinuxSampler page lists <global> as SFZ v1 and <control>, <curve> and <effect> without a standard.
sfizz knows global, control, master, group, region, curve, effect and sample. For any other header name it prints “Unknown header” and ignores the block (Synth.cpp, onParseFullBlock). It has no <midi> handling.
The hierarchy and inheritance
Four headers form a hierarchy: <global>, then <master>, then <group>, then <region>. The two shapes are global / group / region and global / master / group / region (sfzformat.com, headers/index.md). A header’s opcodes stay in force until a header of the same or a higher level comes: a group lasts “till the next group opcode, or till the end of the file” (headers/group.md).
When the same opcode is set at two levels the lower level wins: “If the same opcode is defined in global is also defined in group or region, the group or region setting is used” (headers/global.md); “If the same opcode is defined at both the group and region levels, the region setting overrides the group setting” (headers/group.md). sfizz applies the opcodes of a region in the order global, master, group, region, and a later one replaces an earlier one (Synth.cpp, buildRegion). A <global> clears the master and group opcodes in force, and a <master> clears the group’s (onParseFullBlock).
<global> loop_mode=one_shot seq_length=4
<group> key=36 hivel=31
<region> seq_position=1 sample=kick_vl1_rr1.wav
<region> seq_position=2 sample=kick_vl1_rr2.wav
<group> key=36 lovel=96 seq_length=3
<region> seq_position=1 sample=kick_vl4_rr1.wav
Here both regions of the first group inherit loop_mode and seq_length=4 from the global; the last group overrides seq_length with 3. This is the example of headers/global.md, shortened. The viewer’s tree nests the blocks this way and its Effective tab lists, for every region, each opcode with the header that set it.
Headers outside the hierarchy (<control>, <curve>, <effect>, <midi>, <sample>) do not end a group or a master: the regions after them still inherit from the global, master and group before them (sfizz handles each of these headers without touching the stored opcodes). The viewer puts such a header beside the hierarchy when no header of the hierarchy follows it, and inside the block in force when one does.
<region>
“A region is defined between two <region> headers, or between a <region> header and a <group> header, or between a <region> header and the end of the file” (headers/region.md, the same words as the rgc:audio page). Its opcodes say what to play, when and how. The input controls (keys, velocity, controllers, random range and others) “act using the AND boolean operator”: all must match for the region to play. <region> sample=440.wav plays the sample over the whole keyboard; <region> lokey=64 hikey=67 sample=440.wav plays it for keys 64 to 67.
<group>
The header is not the same thing as the group opcode, which names a mute group (headers/group.md); ARIA adds polyphony_group as an alias for the opcode to lessen the confusion. A group holds the opcodes its regions share, for example ampeg_attack=0.04 ampeg_release=0.45; a region may override any of them.
<global>
Sets values for every region. sfzformat.com says one <global> per file in headers/index.md and, in headers/global.md, that several are possible “at least under ARIA”, each active until the next. sfizz accepts any number.
<master>
Added for the ARIA player between global and group. In the example of headers/master.md each master holds the controller assignments of one instrument inside a file (amplitude_cc30=100, offset_cc33=3000 …) and the groups and regions below it use them. opcodes/include.md pairs it with #include: one master, then the #include of the mapping that belongs to it.
<control>
An SFZ 2 header that should come before <global>. The Cakewalk suite calls it “a pre-processor for the language” (01a - octave offset.sfz). The directives that “should not be used under other headers” (headers/control.md) are #define, default_path, note_offset, octave_offset, label_ccN and set_ccN; ARIA and sfizz add more (Instrument settings). Several <control> headers may be used, “very useful when specifying default_path”; in ARIA and sfizz a new one resets default_path and nothing else, and in Cakewalk products it does not reset it. A <control> that comes after a region affects only the regions after it.
<curve>
Each <curve> defines one curve, which a controller modulation can use through curve_index and the curvecc modifier (Modulation). Its points are v000 to v127, one for each controller value, with values from -1 to 1 (the table gives -1 to 1 for vNNN and 0 to 255 for curve_index). “The default is v000=0 and v127=1. Any points along the curve not defined explicitly will be interpolated linearly between points which are defined.”
<curve>curve_index=17
v000=0
v095=1
v127=1
ARIA has built-in curves, which “cannot be overwritten”; custom curves use curve_index 7 and above, and ARIA allows any integer from 0 to 254. If no curve is named, curve 0 is used.
| Number | Name | Range | Notes |
|---|---|---|---|
| 0 | Default | 0 to 1 | Linear |
| 1 | Bipolar | -1 to 1 | Linear, used by CC10 panning by default |
| 2 | Inverted | 1 to 0 | Linear |
| 3 | Bipolar inverted | 1 to -1 | Linear |
| 4 | Concave | 0 to 1 | Nonlinear, used for CC7 volume tracking and amp_veltrack |
| 5 | Xfin power curve | 0 to 1 | Based on Dimension Pro behaviour |
| 6 | Xfout power curve | 1 to 0 | Based on Dimension Pro behaviour |
(headers/curve.md.) The Cakewalk suite’s test 11 - unknown opcode curve.sfz puts a stray 332=1 in a curve and expects it in the error log.
<effect>
In SFZ 1 only effect1 and effect2 existed, at region level (the sends to two effect buses). SFZ 2 added this header, with effect3 and effect4, and the opcodes bus, type and dsp_order. “The specifics of what can be used under this header differ widely between SFZ players” (headers/effect.md). The effects and their opcodes are on Effects. The Cakewalk suite’s test 10 - unknown opcode fx.sfz puts an unknown opcode in an effect and expects it in the error log.
<midi>
An ARIA extension “added for MIDI pre-processor effects”, deprecated: since ARIA 1.0.8.0 an <effect> section with bus=midi does the same. The sfz-format repository has no description of what the header holds (headers/midi.md is empty), so only its existence and deprecation are described here, and the viewer lists its opcodes without checking them.
<sample>
Embeds an audio file in the SFZ file, as used by the Rapture instrument: <sample> name=mysample.wav data=…, then <region> sample=mysample.wav. The encoding is on Embedded samples.