Question

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.

Was it helpful?

Solution 3

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.

OTHER TIPS

Seems to be a audio problem. Try another WAV file.

Do you get this noise on vista?

I've encounter this problem using the WaveOut WIN32 API. PlaySound uses the same library (Winmm) internally to play the sound.

This noise appears only on certain wave files, and on windows vista (and I think windows 7 too). It works fine on XP. I believe it's a bug in the new implementation of those APIs. If you use windows media player to play those WAV files they play fine (on vista) because I think it uses DirectSound APIs.

I've got no solution for this right now and I am thinking of changing my implementation to use DirectSound in the future.

I had similar problems in the past and I solved it by replacing the audio drivers of the offending machine.

Try reproducing the problem in identical conditions but in a different machine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top