Skip to content

v1 Providers

Axwabo edited this page Feb 1, 2026 · 2 revisions

Providers

Caution

This page is for v1 of SecretLabNAudio. v2 guide

SecretLabNAudio.Core includes some ISampleProvider classes for convenience.

LoopingWaveProvider

Loops the given WaveStream

BufferedSampleProvider

Uses a PlaybackBuffer and reads as much data as possible into the buffer when Read is called.

PlaybackBufferSampleProvider

Exposes methods to read & write from a PlaybackBuffer

RawSourceSampleProvider

Reads data from a float array. This array is stored in a private field, but the caller may modify it if they have a reference to the array passed to the constructor.

The Copy method creates a new RawSourceSampleProvider that references the original array. This way, different providers can seek to different positions without reallocating the entire array.

LoopingRawSampleProvider

Loops the given RawSourceSampleProvider

SampleProviderQueue

Exposes methods to enqueue & dequeue providers from a queue, and reads from them sequentially.

From NAudio

Some important sample providers contained in NAudio.Core are:

  • MixingSampleProvider - combines multiple inputs into one
  • ConcatenatingSampleProvider - sequentially plays the given providers
  • VolumeSampleProvider - sets the volume
  • OffsetSampleProvider - has multiple properties:
    • DelayBy - silence to insert before playing the source
    • SkipOver - time to discard from the beginning of the source
    • Take - limits the maximum samples to read from the source
    • LeadOut - time of appended silence at the end

Extension Methods

NAudio

  • ToSampleProvider(IWaveProvider)
  • FollowedBy(ISampleProvider, ISampleProvider) - concats two providers

SecretLabNAudio

  • ToPlayerCompatible(ISampleProvider) - mixes down and resamples for AudioPlayer compatibility (if required)

  • MixWith(ISampleProvider, ISampleProvider) - mixes two inputs. The first input is returned if it's a MixingSampleProvider - a new mixer is created otherwise

  • Buffer(ISampleProvider, double) - creates a BufferedSampleProvider

  • Queue(ISampleProvider, ISampleProvider) - uses the first or creates a new SampleProviderQueue

  • Volume(ISampleProvider, float) - uses the original or creates a new VolumeSampleProvider

  • ToPlayerCompatible(IWaveProvider) - converts to a sample provider and calls ToPlayerCompatible

  • Loop(WaveStream) - creates a LoopingWaveProvider

  • ReadPlayerCompatibleSamples(WaveStream, bool) - reads the stream into a player-compatible RawSourceSampleProvider

  • ReadSamples(WaveStream, bool) - reads the samples into a RawSourceSampleProvider with the original format

Getting Started

Playing Audio

Advanced

Audio Processors

FFmpeg

v1 Guides

Caution

v1 will be out of support soon.

Clone this wiki locally