tags:

views:

215

answers:

1

I have 2 windowsMediaPlayer objects setup Both objects have the same mp3 song file but when I play them at the same time they are out of sync by a few seconds. The code I call to play them looks like this

     sound1.controls.play();
     sound2.controls.play();

Is it just because one play method is executed before the other and thus one fast then the other. Is their anyway I could sync them? I have tired messing with the rate of one track to match the other, but not getting it prefect.

Thanks

+2  A: 

You can't get this perfect, the players cannot start at the same time by design. You'll need to mix the two songs into a new song, the NAudio library can do this.

Hans Passant
The thing is I was using the 2 obj like channels really. Where I could mute one channel at certain stages.
Ciarán
No problem, muting is multiplying the audio signal by zero.
Hans Passant
I been reading though the source code of that link you sent me. Cant seem to find what I am looking for, any specific class? There are no comments in the source.
Ciarán
@Ciarán: the WaveMixerStream32 class ought to do the job. "WaveStream that can mix together multiple 32 bit input streams."
Hans Passant
Yea looked into that class, and tried to get it to work, but get loads of format exceptions, like IEEE floating point number. I will keep trying anyway. Thanks for your help!
Ciarán