This project has moved. For the latest updates, please go here.

Support for Gapless (seamless) playback

Jul 18, 2011 at 6:17 AM

Dear Mark,

Impressive piece of work you've done with NAudio!

I have tested some of the features and created code.

I was however wondering if there's anyway one can playback sound seamlessly, no matter what lossy or lossless sound source is used?

If so, what are the conditions? And could you post a code sample that will put me in the right direction?

Thanks in advance....


Jul 19, 2011 at 12:50 AM

You will effectively need to read ahead in the stream and work out where a ‘gap’ is – you need to define a gap for yourself, how long it will be, what tolerance of the volume you want etc. then you will need to read the stream that you’re going to mix it with and work out when is the right time to fade in again (similar things to be worked through, tolerance of volume etc).

Then it’s just a matter of mixing the two streams together at the right point in time; fade in the second stream as you fade out the first.