I have a very simple console application where I'm trying to play a wav file with SoundPlayer.
static void Main(string[] args)
{
SoundPlayer sp = new SoundPlayer("path/to/sound.wav");
while(true){
Console.ReadLine();
sp.PlaySync();
}
}
It works fine except when PlaySync() is right after Console.ReadLine(). It seems the longer I wait before putting an input, the lower the volume of the sound.
I have tried using sp.Play() (the asynchronous version) and I have tried putting a Thread.Sleep() delay between them. There was no difference. What could be the cause of this?
(This is my first post here so forgive my mistakes)
The answer is as simple as the question. Use
Stop()every timePlaySync()is called.