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

Waveoutevent player Fade In/Out

Sep 8, 2015 at 11:25 AM
Edited Sep 8, 2015 at 11:57 AM
Hi ,

I have developed NAudio waveoutevent player. I want to developed Fade In/Out option alsio. Ex: While playing the sounds,if i click FadeOut / FadeIn .
Please help me to do this

Sep 10, 2015 at 12:40 AM
Edited Sep 10, 2015 at 12:42 AM
use FadeInOutSampleProvider
Sep 10, 2015 at 12:03 PM
Edited Sep 10, 2015 at 12:04 PM
Thank you for your replay, I got the solution. But the small problem FadeInOut working fine but volume meter option not working. Only one will work at the same time.

EX :

Player.Init(new SampleToWaveProvider(fadeInOut)); // FadeInOut works

Player.Init(new SampleToWaveProvider(postVolumeMeter)); // volume meter works

How to work both in a single player.I want to use FadeInOut and volume meter .Please do for need full.

Thank You.
Sep 10, 2015 at 1:08 PM
You need to build a signal chain like that:
        Dim Reader As New Mp3FileReader("")
        Dim FadeInOut = New FadeInOutSampleProvider(Reader.ToSampleProvider)
        Dim PostVolume = New VolumeSampleProvider(FadeInOut)
        Dim WO As New WaveOut()
Sep 10, 2015 at 3:27 PM
Thank you sir, But we are using Wav file in C# project. So, I can't use VolumeSampleProvider

Here my code:

file = new AudioFileReader(fileName);
fadeInOut = new FadeInOutSampleProvider(file);
var waveChannel = new SampleChannel(file, true);
                                 var postVolumeMeter = new MeteringSampleProvider(waveChannel);        
                                 var postVolumeMeter = new MeteringSampleProvider(__fadeInOut__);     ///  "here i cant add VolumeSampleProvider "
postVolumeMeter.StreamVolume += OnPostVolumeMeter_Stack;
Player.Init(new SampleToWaveProvider(postVolumeMeter));

I want to use MeteringSampleProvider and VolumeSampleProvider. Please help me to do this .

Thank You.
Sep 10, 2015 at 11:03 PM
Seems, you have no clue what "signal chain" means... Anyway, change:
var waveChannel = new SampleChannel(file, true);
var waveChannel = new SampleChannel(fadeInOut, true);
And it should work. Btw, signal chain means, that all classes are connected by referring to the class before. The data is then pulled through all of them when the audio device requests a new block.


PS: Please mind a correct presentation and pronounciation in future, either nobody will want to help you.