This project has moved and is read-only. For the latest updates, please go here.

Modify current audio output stream (add effect)

Mar 1, 2015 at 2:35 PM
Greetings all,

my goal is to modify the current audio output stream in order to apply audio effects such as echo or reverb. I currently don't have a clue on how to achieve this with NAudio, but I think it should be possible.

First I would have to retrieve the current active audio output device, then I'd have to apply an effect. Can anyone show me how this can be done?

Thanks in advance!
Mar 2, 2015 at 4:58 PM
If you want to add effects to audio that you are playing yourself with NAudio, then this is done simply by creating an ISampleProvider that processes the samples as they are played. You would need to create the effect algorithms yourself, or borrow them from elsewhere.

However, if you want to intercept sound being played by other applications, this is not something that the underlying Windows audio infrastructure allows you to do easily, and cannot be done with NAudio.
Mar 2, 2015 at 5:06 PM
Windows can do that? Sounds interesting. How?` Ps. I'm looking forward to modify the sound of all running applications, i.e. the output device (speakers)
Mar 7, 2015 at 11:54 PM
I've been experementing with the WasapiLoopbackCapture and WasapiOut. All I think I need to do, is something like
    record for 100ms
    play recorded input
Can you help me out with the object model of NAudio? It's complicated and I don't see through...

Would appreciate that :)
Mar 8, 2015 at 12:18 AM
This is what I have so far, but it's only causing some sort of noise. I also don't see a way to control how often "DataAvailable" is called. I would rather like to record like 100ms and then play it at half volume to create the echo effect.
WasapiLoopbackCapture waveIn = new WasapiLoopbackCapture();
waveIn.DataAvailable += delegate(object sender, WaveInEventArgs e)
        byte[] bytes;
        using (MemoryStream mem = new MemoryStream())
            using (WaveFileWriter file = new WaveFileWriter(mem, new WaveFormat(44000, 2)))
                file.Write(e.Buffer, 0, e.BytesRecorded);
            bytes = mem.ToArray();
        WaveOut waveOut = new WaveOut();
        waveOut.Init(new WaveFileReader(new MemoryStream(bytes)));
    catch (Exception ex)