0

I created a .wav file which helds exactly a complete sine wave. You can verify by open it with Audacity or similar.

https://mega.co.nz/#!DkR3gKia!dV9zDtdzmqHDDkEUeZviYf78SDkkxWVjUTy8kYEJnio

I want to play this file using the C# .Net SoundPlayer. Like here:

static void Main(string[] args)
    {
        using (SoundPlayer sad = new SoundPlayer("D:\\Soundlocator\\test.wav"))
        {
            while (true)
            {
                sad.PlaySync();
                Thread.Sleep(100);
            }
        }
    }

What I can see from the oscilloscope is less than half of the sine wave.

enter image description here

Can anyone tell me why? Maybe my wav file header is not correct? Playing the same file using vlc or Audacity gives me the full sine wave as expected.

user2799180
  • 719
  • 1
  • 11
  • 29
  • Have you tried playing in windows media player on that wav file and see if that's not broken? – 123 456 789 0 Jan 28 '14 at 16:56
  • 1
    That is odd. Could you try using the PlayLooping instead of PlaySync method, and maybe get rid of the while(true) loop? – rla4 Jan 28 '14 at 17:16
  • I tried with other player. It is working as it should. Only the SoundPlayer makes problems. PlayLooping does the job but I want to add a pause between playing the wav files and for that reason that would not work. Any ideas how this is possible? I can not find the problem. – user2799180 Jan 29 '14 at 07:12

1 Answers1

0

I still do not know where the problem is coming from. What I did to overcome this issue was to add some pause (0's) to the end of the file. Now it looks like it should. In combination with PlayLooping it does not exactly what it should.

Though the problem that the SoundPlayer does not work right on this WAV still exists.

user2799180
  • 719
  • 1
  • 11
  • 29