Visual Basic 2010 Play Sound File

Playing Sounds (Visual Basic) • • 2 minutes to read • Contributors • • • • • • In this article The My.Computer.Audio object provides methods for playing sounds. Playing Sounds Background playing lets the application execute other code while the sound plays.
Nov 22, 2010 For this tutorial, wav sound files will be used. This tutorial will cover three ways sound files can be played: Hard coded. Play mp3,mid. Files on VB 2010! First Of all We need to add a reference to the windows media player (wmp.dll). Go to Project ->Add Reference (see tut1.png). I’ve recenty been making an example program with Visual Basic.NET 2008 on snapping forms to the edge of the screen. I wanted the program to play a sound wave file.

The My.Computer.Audio.Play method allows the application to play only one background sound at a time; when the application plays a new background sound, it stops playing the previous background sound. You can also play a sound and wait for it to complete. In the following example, the My.Computer.Audio.Play method plays a sound. When AudioPlayMode.WaitToComplete is specified, My.Computer.Audio.Play waits until the sound completes before calling code continues. When using this example, you should ensure that the file name refers to a.wav sound file that is on your computer Sub PlayBackgroundSoundFile() My.Computer.Audio.Play('C: Waterfall.wav', AudioPlayMode.WaitToComplete) End Sub In the following example, the My.Computer.Audio.Play method plays a sound. Soulja Slim Discography Rar. When using this example, you should ensure that the application resources include a.wav sound file that is named Waterfall.
Sub PlayBackgroundSoundResource() My.Computer.Audio.Play(My.Resources.Waterfall, AudioPlayMode.WaitToComplete) End Sub Playing Looping Sounds In the following example, the My.Computer.Audio.Play method plays the specified sound in the background when PlayMode.BackgroundLoop is specified. When using this example, you should ensure that the file name refers to a.wav sound file that is on your computer. Sub PlayLoopingBackgroundSoundFile() My.Computer.Audio.Play('C: Waterfall.wav', AudioPlayMode.BackgroundLoop) End Sub In the following example, the My.Computer.Audio.Play method plays the specified sound in the background when PlayMode.BackgroundLoop is specified. Developmental Biology Gilbert 9th Ed Pdf. When using this example, you should ensure that the application resources include a.wav sound file that is named Waterfall. Sub PlayLoopingBackgroundSoundResource() My.Computer.Audio.Play(My.Resources.Waterfall, AudioPlayMode.BackgroundLoop) End Sub The preceding code example is also available as an IntelliSense code snippet. In the code snippet picker, it is located in Windows Forms Applications >Sound. For more information, see.