Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: Fading to to 50%

$
0
0

Hi,

Thanks for pointing me in the right direction, I ended up rewriting the FadeInOutSampleProvider, fading down to 50% could be done changing the mupliplier and fading up in the middle of the track by adding a few more states and checking the total time converted to samples.

Fading down: 1.0F - 0.5F * (fadeSamplePosition / CSng(fadeSampleCount))

Fading up:  0.5F + 0.5F * (fadeSamplePosition / CSng(fadeSampleCount))

Though I have a problem knowing how to get the result into the mixer.

Dim wave_song As WaveStream = New AudioFileReader("c:\samples\song.mp3")Dim song_isample As ISampleProvider = New WaveToSampleProvider(wave_song)Dim fader As myFadeInOutSampleProvider
fader = New myFadeInOutSampleProvider(song_isample)
fader.setfade(5000, 20000) Dim waveprovider As SampleToWaveProvider = New SampleToWaveProvider(fader)Dim mixer As WaveMixerStream32
mixer = New WaveMixerStream32()' Doesnt work
mixer.AddInputStream(waveprovider)
mixer.AddInputStream(wave2) ' From above snippet' Works
WaveFileWriter.CreateWaveFile("c:\samples\test2.wav", waveprovider)

 

How can I convert back to a wavestream from my fader Isampleprovider so i can put it in the mixer.

Karl

 


Viewing all articles
Browse latest Browse all 5831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>