Table of Contents

Class SfzParser

Namespace
NAudio.Sfz
Assembly
NAudio.Core.dll

Parses SFZ instrument files into an SfzInstrument: handles comments, the #define/$variable preprocessor, #include, the section headers and the opcode=value grammar (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.

public static class SfzParser
Inheritance
SfzParser
Inherited Members

Methods

Parse(string, ISfzIncludeResolver)

Parses SFZ text. includeResolver supplies the text of #included files; if null, includes are skipped.

public static SfzInstrument Parse(string text, ISfzIncludeResolver includeResolver = null)

Parameters

text string
includeResolver ISfzIncludeResolver

Returns

SfzInstrument

ParseFile(string)

Loads and parses an SFZ file, resolving #includes and relative sample default_paths against the file's directory.

public static SfzInstrument ParseFile(string path)

Parameters

path string

Returns

SfzInstrument