Search code examples
c#audiopitchsoundplayerwav

C# - .WAV Playback Randomly High Pitch


For some reason, when a WAV file is played back using the snippet below, it randomly plays back screwy, like a high pitch noise. It doesn't happen all the time, just randomly. It seems to happen more often when it is played back more frequently. The WAV properties are below along with the code snippet I am using.

WAV Properties:

Bit Rate - 750kbps
Audio Sample Size - 16 bit
Channels - 1 (mono)
Audio Sample Rate - 44kHz
Audio Format - PCM

Snippet:

System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer(Captcha.Properties.Resources.sound1);
myPlayer.Play();

Is this because of the way I am playing the file or the file itself? Thank you.


Solution

  • So the reason for this either seems to be a problem with the WAV file itself or a bug in .NET. Most likely it is a problem with the file and I'll either try working with the file to see if that helps or just use another file altogether. Thank you for your help everyone.