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

Ciarán
  • 773
  • 2
  • 7
  • 20

1 Answers1

2

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
  • 922,412
  • 146
  • 1,693
  • 2,536
  • The thing is I was using the 2 obj like channels really. Where I could mute one channel at certain stages. – Ciarán Apr 02 '10 at 03:57
  • No problem, muting is multiplying the audio signal by zero. – Hans Passant Apr 02 '10 at 09:25
  • 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 Apr 03 '10 at 13:33
  • 1
    @Ciarán: the WaveMixerStream32 class ought to do the job. "WaveStream that can mix together multiple 32 bit input streams." – Hans Passant Apr 03 '10 at 14:12
  • 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 Apr 04 '10 at 14:05