Looping one wave file while the other ends

Jul 29, 2011 at 8:54 AM

Hi,

i try to play two wavefiles at once by using a WaveMixerStream32. I managed to play them at the same time. But i need to loop one wavefile.

My question is: How can i loop one of the wavefiles while the other ends normally.

Aug 1, 2011 at 8:57 AM
Edited Aug 1, 2011 at 9:04 AM

Maybe someone can tell me if it's possible to loop one stream of a mixer while the other ends normally.

Coordinator
Aug 9, 2011 at 2:18 PM

you would do this by creating your own derived WaveStream class to perform the looping - in the Read method, just go back to the beginning of the source when you reach its end. Then that can be passed in as a mixer input.

Aug 17, 2011 at 12:03 PM
Edited Aug 19, 2011 at 10:49 AM

Yes this should work, i know. but my problem is that if you jump back to the start, you can here a snap. I modified my wavefiles so that the fist and last samplevalues are nearly the same. so if i loop them in audacity the loop is perfect. but with the WaveMixerStream32 the problem stays.

I tried to use just a normal Wavestream and initialized my IWavePlayer with this one. With this method the loop is perfect,

I dont know why this works. With the mixer i did the same and its not working correctly.

the only difference of these  two methods is, that if i use the mixer all methods of the derived WaveStream class are used several times. withot the mixer, only the read method and the costructor are used.

i start to think, that the snap on the jump back is a consequence of the time that the processor need to call all thes methods. but i am not sure.

Sorry if there is some bad english and confusing sentence in this post, but i try my best -.-

Nov 11, 2011 at 9:27 PM

Did you ever solve this?  I'm running into the same problem (my fading operations increase the clicks instead of removing them) and not having any prior experience with audio processing I'm not sure where to start looking for answers.

Nov 12, 2011 at 8:59 AM

I never solved this problem. I created an "offline-loop" of the wavefiles i wanted to loop in my class.

Nov 12, 2011 at 11:53 PM

Meanwhile I figured out how to debug: simply add a WaveFileWriter to save the .wav and inspect the waves in Audacity.

The cause is easy to see there: it isn't in the mixer but the samples I fed to it.