Table of Contents

Class SfzInstrument

Namespace
NAudio.Sfz
Assembly
NAudio.Core.dll

A parsed SFZ instrument: the flattened playable SfzRegions, the raw SfzSections in document order, and the file-wide <control> settings. Produced by SfzParser.

public sealed class SfzInstrument
Inheritance
SfzInstrument
Inherited Members

Properties

DefaultPath

The default_path from the <control> section (backslashes normalised to forward slashes), or null if none was set. Already applied to each region's Sample.

public string DefaultPath { get; }

Property Value

string

InitialControllerValues

Initial MIDI controller values from <control> set_ccN opcodes (values clamped to 0–127; the last setting per controller wins), or null when the file sets none. A player should seed each channel's controller state with these at load time — they matter because loccN/hiccN gating reads controllers that otherwise default to 0 — without treating them as controller changes (so on_loccN/on_hiccN trigger regions must not fire from them).

public IReadOnlyList<(int Controller, int Value)> InitialControllerValues { get; }

Property Value

IReadOnlyList<(int Controller, int Value)>

NoteOffset

The note_offset from <control> (default 0).

public int NoteOffset { get; }

Property Value

int

OctaveOffset

The octave_offset from <control> (default 0).

public int OctaveOffset { get; }

Property Value

int

Regions

The playable regions, with their opcodes fully merged.

public IReadOnlyList<SfzRegion> Regions { get; }

Property Value

IReadOnlyList<SfzRegion>

Sections

Every parsed section, in the order written.

public IReadOnlyList<SfzSection> Sections { get; }

Property Value

IReadOnlyList<SfzSection>

Methods

MapRegions()

Interprets every region's opcodes into typed SfzMappedRegions, applying this instrument's note/octave offsets.

public IReadOnlyList<SfzMappedRegion> MapRegions()

Returns

IReadOnlyList<SfzMappedRegion>