Вопрос

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.

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top