Namespace NAudio.Sfz
Classes
- FileSfzIncludeResolver
An ISfzIncludeResolver that reads includes from the file system, resolving relative paths against a base directory.
- SfzInstrument
A parsed SFZ instrument: the flattened playable SfzRegions, the raw SfzSections in document order, and the file-wide
<control>settings. Produced by SfzParser.
- SfzMappedRegion
An SFZ region with its Tier-1 and Tier-2 opcodes interpreted into typed, engine-ready synthesis parameters: absolute key/velocity ranges (note names resolved, offsets applied), tuning in cents, volume in dB, pan normalised to ±1, the amplitude envelope in seconds, the filter, loop behaviour, sample offsets, group/trigger routing, note-on selection (keyswitches, round-robin, random and CC windows), crossfades, the per-region LFOs/EGs and EQ bands, effect sends and release decay.
This is the SFZ semantic layer, the counterpart to the SoundFont generator model. It does not load samples or touch the voice engine — projecting both formats onto one neutral model the engine plays is the next step.
- SfzNoteName
Parses SFZ key values, which may be a MIDI note number (0–127) or a note name such as
c4,c#3ordb5— case-insensitive, in both the letter and the flat (Db4,dB4andDB4all equaldb4). SFZ uses the convention that middle C (c4) is MIDI note 60, soc-1is 0.
- SfzParser
Parses SFZ instrument files into an SfzInstrument: handles comments, the
#define/$variablepreprocessor,#include, the section headers and theopcode=valuegrammar (including sample paths that contain spaces), then flattens the global/master/group/region hierarchy into playable regions.A
<always starts a header, even without surrounding whitespace (<group><region>,<region>sample=a.wav), matching real players' behaviour; consequently a sample path may contain spaces but never<.This is the text/structure layer only — opcode semantics (key ranges, tuning, envelopes…) and external sample loading are applied by later layers on top of the parsed model.
- SfzRegion
A fully-resolved SFZ region: the merged opcode set that applies to it (
<global>→<master>→<group>→<region>, most specific winning), with typed accessors. This is the SFZ counterpart of SoundFontRegion; mapping these opcodes onto the format-neutral synthesis model is a later step.
- SfzSection
One parsed SFZ section: a header and the
opcode=valuepairs that followed it, in the order written. This is the raw parse result before the global/master/group/region hierarchy is flattened into SfzRegions.
Structs
- SfzEqBand
One per-region SFZ EQ band (
eqN_freq/eqN_bw/eqN_gain): a centre frequency in Hz, a bandwidth in octaves and a gain in dB.
- SfzLfo
One per-region SFZ LFO (
amplfo_,fillfo_orpitchlfo_*): a rate in Hz, a modulation depth (dB for the amplitude LFO, cents for the filter and pitch LFOs) and an onset delay in seconds. All values default to 0.
- SfzModulationEnvelope
One per-region SFZ modulation envelope (
fileg_orpitcheg_): a DAHDSR shape in seconds (sustain as a percentage, default 100) and a modulation depth in cents. An envelope with zero depth modulates nothing.
Interfaces
- ISfzIncludeResolver
Resolves
#include "file.sfz"directives to their text. The default FileSfzIncludeResolver reads from disk relative to the including file; tests (or virtual file systems) can supply their own.
Enums
- SfzCrossfadeCurve
The curve a crossfade uses (SFZ
xf_keycurve/xf_velcurve).
- SfzFilterType
The filter family selected by SFZ
fil_type.
- SfzHeader
The SFZ section headers. An
.sfzfile is a sequence of sections, each introduced by one of these in angle brackets (e.g.<region>) and followed byopcode=valueassignments.
- SfzLoopMode
SFZ
loop_modevalues.
- SfzOffMode
SFZ
off_modevalues — how a region is silenced by its group.
- SfzTrigger
SFZ
triggervalues.