Table of Contents

Class SingleSampleSampler

Namespace
NAudio.Sampler
Assembly
NAudio.Sampler.dll

Plays a SingleSampleInstrument polyphonically as an ISampleProvider, through the shared SamplerEngine (so it gets pitch, looping, the amplitude envelope, pan, voice stealing and the reverb/chorus sends for free). Edits to Instrument are reflected by the next note played.

public sealed class SingleSampleSampler : SamplerEngine, IMidiInstrument, ISampleProvider
Inheritance
SingleSampleSampler
Implements
Inherited Members
Extension Methods

Constructors

SingleSampleSampler(SingleSampleInstrument, int, int)

Creates a sampler for a single-sample instrument.

public SingleSampleSampler(SingleSampleInstrument instrument, int sampleRate = 44100, int maxVoices = 32)

Parameters

instrument SingleSampleInstrument
sampleRate int
maxVoices int

Properties

Instrument

The instrument being played. Mutate its properties to edit it live.

public SingleSampleInstrument Instrument { get; }

Property Value

SingleSampleInstrument

Methods

FromWaveFile(string, int, int, int)

Loads a WAV file and maps it across the keyboard at rootKey.

public static SingleSampleSampler FromWaveFile(string path, int rootKey = 60, int sampleRate = 44100, int maxVoices = 32)

Parameters

path string
rootKey int
sampleRate int
maxVoices int

Returns

SingleSampleSampler