Table of Contents

Class SoundFontRegion

Namespace
NAudio.SoundFont
Assembly
NAudio.Core.dll

A single fully-resolved, playable SoundFont region: one sample, the key/velocity rectangle over which it sounds, and the accumulated generator values that apply (preset offsets already added to the instrument values, per SoundFont 2.04 §9.4). Produced by SoundFontInstrumentResolver.

A region is the SoundFont equivalent of an SFZ <region>; NAudio.Sampler's format-neutral region model is a projection of this.

public sealed class SoundFontRegion
Inheritance
SoundFontRegion
Inherited Members

Properties

Generators

The accumulated generator values that apply to this region.

public SoundFontGenerators Generators { get; }

Property Value

SoundFontGenerators

HighKey

Highest MIDI key (inclusive) this region responds to.

public byte HighKey { get; }

Property Value

byte

HighVelocity

Highest MIDI velocity (inclusive) this region responds to.

public byte HighVelocity { get; }

Property Value

byte

InstrumentModulators

The instrument-level modulators that apply to this region (the global instrument zone's modulators followed by the local zone's), in the order they should be combined — later entries supersede earlier ones with identical routing (SoundFont 2.04 §9.5). These are absolute modulators: they replace the implicit default modulators of the same routing. Modulator resolution (merging with the defaults and evaluating against live controllers) is the synthesiser's job.

public IReadOnlyList<Modulator> InstrumentModulators { get; }

Property Value

IReadOnlyList<Modulator>

LowKey

Lowest MIDI key (inclusive) this region responds to.

public byte LowKey { get; }

Property Value

byte

LowVelocity

Lowest MIDI velocity (inclusive) this region responds to.

public byte LowVelocity { get; }

Property Value

byte

PresetModulators

The preset-level modulators that apply to this region (global preset zone followed by local), ordered for §9.5 combination. These are additive: their effect is summed on top of the instrument-level result rather than replacing it.

public IReadOnlyList<Modulator> PresetModulators { get; }

Property Value

IReadOnlyList<Modulator>

Sample

The sample this region plays.

public SampleHeader Sample { get; }

Property Value

SampleHeader

Methods

Matches(int, int)

Whether this region should sound for the given key and velocity.

public bool Matches(int key, int velocity)

Parameters

key int
velocity int

Returns

bool

ToString()

public override string ToString()

Returns

string