I am trying to play a typing sound every time a key is pressed, using the SoundPlayer class (to simulate typewriter sounds).
public void MyKeyDown(object sender, KeyEventArgs)
{
player = new System.Media.SoundPlayer(@"f:\sounds\2.wav");
player.Play();
}
It works fine... as long as you type around 20 words per minute. Any faster than that and the sounds aren't played in full or even stop playing completely until you slow down
2.wav is a 8kb sound file with a duration of 0.1 seconds, so based on the sound duration alone, the file could be played in full 600 times per minute (enough for a typing speed of about 90 wpm).
Is there any faster way to play a sound file, or is the problem somewhere else?