Tag Archives: waveform

How to Easily Play Wave Files with Visual Basic.NET and Newer

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
 

It’s actually quite easy to play wave files (.wav waveform based sound files) using just alittle code in some cases. The .NET Framework 2.0, 3.5, 4.0, and higher has a managed wrapper around the PlaySound API.

The easiest way to play wave files with Visual Basic 2005, VB 2008, VB 2010, and newer is as shown below…

    'Play a wave sound file from a specified location.
    My.Computer.Audio.Play("mysoundlocation.wav")

    'Stop the file from playing.
    My.Computer.Audio.Stop()

    'Play a Windows system sound.
    My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Beep)

The code above simply used the MY Interface for quick access to the Audio class to play a file, stop the playback, and then playback a system sound.


What about playing wave sound files with Visual Basic.NET 2002 and Visual Basic.NET 2003?

Continue reading