Can't hear WAVE file. No sound, no errors.
Hi,
I'm sure this has been done to death but I need some help to play a WAVE file.
I'm using Windows 11 and VB.NET 2026.
Code:
Try
'My.Computer.Audio.Play("e:\MyStuff\TestTone.wav", AudioPlayMode.WaitToComplete)
My.Computer.Audio.Play(A, AudioPlayMode.WaitToComplete)
Catch ex As Exception
Stop
End Try
If tried both a file and a byte array, no luck.
Any ideas?
Re: Can't hear WAVE file. No sound, no errors.
Perhaps a bit more information.
Decades ago I used a database called Clipper and it had a neat function that played a specified pitch for a specified duration.
I wanted that ability in VB.NET.
I created a function that creates a WAV file with a specified pitch and duration. PlayPitch(440, 1)
Everything works except the play function.
If I use Windows Explorer I can click on the file and I can hear the sound.
Weird huh?
Re: Can't hear WAVE file. No sound, no errors.
Hi Folks,
A little sheepish here, I found the problem. I had a parameter wrong in the format chunk.
After a great deal of detective work I found the issue.
IT WORKS!
I'm still confused as the original file played in the media player but not VB.NET
Re: Can't hear WAVE file. No sound, no errors.
VB.Net wave players are temperamental, but the rule is they must be PCM wav files. I’m not sure what caused your file not working though…
Re: Can't hear WAVE file. No sound, no errors.
Just as a matter of curiosity, how are you creating the wav file? Do you mind sharing?