Table of Contents

Namespace NAudio.SoundFont

Classes

Generator

Soundfont generator

InfoChunk

A soundfont info chunk

Instrument

SoundFont instrument

Modulator

Modulator

ModulatorType

Modulator source enumerator — the controller that drives a Modulator. Decodes the 16-bit "Sf2 modulator source" bit-field (SoundFont 2.04 §8.2): bits 0-6 are the controller index, bit 7 selects a MIDI continuous controller, bit 8 is the direction, bit 9 is the polarity, and bits 10-15 are the transform/source type.

Preset

A SoundFont Preset

PresetsChunk

Class to read the SoundFont file presets chunk

SFVersion

SoundFont Version Structure

SampleHeader

A SoundFont Sample Header

SoundFont

Represents a SoundFont

SoundFontGenerators

A resolved set of SoundFont generator values, indexed by GeneratorEnum. Instances start from the SoundFont 2.04 default values (§8.1.3) and are then modified by zone generators during instrument resolution (see SoundFontInstrumentResolver).

Values are the raw signed generator amounts from the file; the units (cents, timecents, centibels, etc.) are interpreted by the synthesiser (see NAudio.Dsp.SynthMath). Range and index generators (KeyRange, VelocityRange, Instrument, SampleID) are not stored here — they drive zone selection and are surfaced on SoundFontRegion instead.

SoundFontInstrumentResolver

Flattens a SoundFont Preset into a list of fully-resolved, playable SoundFontRegions, applying the SoundFont 2.04 generator model (§9.4):

  • instrument-zone generators are absolute values applied on top of the SoundFont defaults;
  • a global instrument zone (the first zone with no sample) supplies defaults for the other instrument zones;
  • preset-zone generators are additive offsets added to the instrument result, with a global preset zone supplying preset-level defaults;
  • key and velocity ranges are the intersection of the preset-zone and instrument-zone ranges.

The result is independent of the rest of the file, so it can be cached per preset and handed to the synthesiser.

SoundFontRegion

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.

Zone

A SoundFont zone

Enums

ControllerSourceEnum

Controller Sources

GeneratorEnum

Generator types

SFSampleLink

Sample Link Type

SampleMode

SoundFont sample modes

SourceTypeEnum

Source Types

TransformEnum

Transform Types