src/NAudio.Sampler/README.md
A cross-platform software sampler for NAudio. Play MIDI through SoundFont (.sf2) and SFZ instruments, or a single sample mapped across the keyboard. Truly cross-platform — net9.0, no [SupportedOSPlatform].
SoundFontSampler plays .sf2 instruments, including the SF2 modulator engineSfzSampler plays SFZ instruments, with ISfzSampleLoader / FileSfzSampleLoader for resolving the referenced sample filesSingleSampleInstrument / SingleSampleSampler map one sample across the keyboardSamplerEngine with DAHDSR envelopes, LFOs, modulated filters (SamplerFilterType), crossfade curves (SamplerCrossfadeCurve), trigger modes (SamplerTrigger) and reverb/chorus sendsEach sampler is exposed as an ISampleProvider, so it drops straight into any NAudio mixer or output pipeline.
Reach for this package when you want to render MIDI to audio using SoundFont or SFZ instruments, or build a sample-based instrument, on any platform NAudio runs on. It builds on NAudio.SoundFile for sample loading and is not pulled in by the NAudio meta-package — reference it explicitly:
dotnet add package NAudio.Sampler
For a worked walkthrough see the NAudio.Sampler tutorial.
See the NAudio documentation site for tutorials and the full API reference, or the GitHub repository for full documentation and tutorials.
MIT.