Class SfzSampler
A polyphonic software sampler that plays an SFZ instrument, rendering 32-bit float stereo through the ISampleProvider pull model. Built on the shared SamplerEngine, so it gets the same voice engine as SoundFontSampler (pitch, looping, DAHDSR envelope, resonant filter, pan, voice stealing, exclusive groups, reverb/chorus sends).
An SFZ file is a single instrument (no banks/programs), so every channel plays the same region set. Regions whose sample is missing are dropped at load time. Note-on selection (keyswitches, round-robin, random layers, CC gating) and the Tier-1 opcode coverage are applied by the engine and NAudio.Sampler.SfzRegionProjector.
public sealed class SfzSampler : SamplerEngine, IMidiInstrument, ISampleProvider
- Inheritance
-
SfzSampler
- Implements
- Inherited Members
- Extension Methods
Constructors
SfzSampler(SfzInstrument, ISfzSampleLoader, int, int)
Creates a sampler for a parsed SFZ instrument, loading its samples via
loader.
public SfzSampler(SfzInstrument instrument, ISfzSampleLoader loader, int sampleRate = 44100, int maxVoices = 64)
Parameters
instrumentSfzInstrumentloaderISfzSampleLoadersampleRateintmaxVoicesint
Properties
RegionCount
The number of playable regions loaded.
public int RegionCount { get; }
Property Value
Methods
FromFile(string, int, int)
Loads and parses an .sfz file and its samples, resolving relative
paths against the file's directory.
public static SfzSampler FromFile(string path, int sampleRate = 44100, int maxVoices = 64)