Skip to content

ProcessorChain

Axwabo edited this page Feb 25, 2026 · 1 revision

ProcessorChain

This audio processor lets providers be nested while cleanly providing a way to access to the original, as well as to each processing step.

The chain is sort of like a Stack - the last item is the final (Master) output.

Various extension methods exist to modify a ProcessorChain with some being applicable to the IAudioProcessor interface as well.

The Source is the same as Master if no layers are present.

Use the Layer method to push a new layer. No new layer is added if you return the provider passed to the delegate.

Use the Pop method to remove the last layer. This does nothing if no layers are present.

Example
using NAudio.Wave;
using NAudio.Wave.SampleProviders;
using SecretLabNAudio.Core.Processors;
using SecretLabNAudio.Core.Extensions.Processors;

ISampleProvider provider = GetProviderSomehow();

ProcessorChain chain = provider.ToCompatibleChain()
    .Volume(0.5f)
    .Buffer(2d) // read ahead by 2 seconds
    .Layer(static provider => new SmbPitchShiftingSampleProvider(provider) 
    {
        PitchFactor = 0.5f // one octave down
    });

Getting Started

Playing Audio

Advanced

Audio Processors

v1 Guides

Caution

v1 will be out of support soon.

Clone this wiki locally