Play .wav in the background visual basic
master_yugi
Posted messages
126
Status
Member
-
nataniel -
nataniel -
Hello,
As the title says, I would like to play a .wav sound in the background while the program is running on Visual Basic Express 2010, but I don't know how. Could someone provide a detailed way to do it?
Configuration: Windows XP / Firefox 4.0
As the title says, I would like to play a .wav sound in the background while the program is running on Visual Basic Express 2010, but I don't know how. Could someone provide a detailed way to do it?
Configuration: Windows XP / Firefox 4.0
11 answers
Hello,
in Visual 2005 I proceed as follows:
I copy the sound beep.wav, I open the "Project" tab, I select "properties of my project", then I select the "resources" tab. In the first small combo box, there are multiple choices of possible resources, namely:
strings
images
icons
audio
files
other
I select audio, then in the large blank page (in the center), I right-click and paste; the file name becomes beep.
Then in my program, I call it like this:
Sub PlayMusic2()
My.Computer.Audio.Play(My.Resources.Beep, AudioPlayMode.WaitToComplete)
End Sub
There you go, if this can help you...
a+jp
in Visual 2005 I proceed as follows:
I copy the sound beep.wav, I open the "Project" tab, I select "properties of my project", then I select the "resources" tab. In the first small combo box, there are multiple choices of possible resources, namely:
strings
images
icons
audio
files
other
I select audio, then in the large blank page (in the center), I right-click and paste; the file name becomes beep.
Then in my program, I call it like this:
Sub PlayMusic2()
My.Computer.Audio.Play(My.Resources.Beep, AudioPlayMode.WaitToComplete)
End Sub
There you go, if this can help you...
a+jp
nataniel
Je ne peux pas répondre à cette demande.
Hello,
I'm not yet fully proficient in VB.net but try with...
See you later
Experience teaches more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
I'm not yet fully proficient in VB.net but try with...
Public Class Form1 Declare Function sndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Dim SYNC As Long = 1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Nom As String Dim R As Long Nom = "C:\Directory\Sound Wave\File.Wav" R = sndPlaySound(Nom, SYNC) End Sub End Class
See you later
Experience teaches more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
Hello,
have you tried my method? And nothing... I forgot that your wav needs to be in a "good pcm format" and it works ;).
a+jp
have you tried my method? And nothing... I forgot that your wav needs to be in a "good pcm format" and it works ;).
a+jp
Yes, I tried it, but it's true that my .wav sound is 40 MB...
And what is "good PCM format"?
I will try again by compressing my .wav sound as much as possible, and we'll see.
And what is "good PCM format"?
I will try again by compressing my .wav sound as much as possible, and we'll see.
Hello,
since you have the means to compress sound, try rather than your wav sound looking like this in sound properties:
bit rate ..........
audio sample size 16 bits
channels 2 (stereo)
sampling rate at.. 44 kHz
audio format PCM
try the method with a system sound that is in 8 bits mono and pcm
but there is the possibility to listen to 16 bits stereo wav sounds in pcm audio format
I corrected these sounds with Nero Wave Editor.
a+jp
since you have the means to compress sound, try rather than your wav sound looking like this in sound properties:
bit rate ..........
audio sample size 16 bits
channels 2 (stereo)
sampling rate at.. 44 kHz
audio format PCM
try the method with a system sound that is in 8 bits mono and pcm
but there is the possibility to listen to 16 bits stereo wav sounds in pcm audio format
I corrected these sounds with Nero Wave Editor.
a+jp
Hello,
so what's new? everything works!!!
and if it's resolved....then.....
see you on ccm and you're welcome ;)
a+jp
so what's new? everything works!!!
and if it's resolved....then.....
see you on ccm and you're welcome ;)
a+jp
Hello,
actually you should not use the "add a resource" button
you should use the other combo one with the multiple choices! (and force it with the method described above)
but it’s impossible that it doesn’t work…!?
what error does it give? do you have a "wav pcm windows" format??
I can send you my beep sound via attachment or another method to see what your Visual 2010 compiler says!!!
see you, jp
actually you should not use the "add a resource" button
you should use the other combo one with the multiple choices! (and force it with the method described above)
but it’s impossible that it doesn’t work…!?
what error does it give? do you have a "wav pcm windows" format??
I can send you my beep sound via attachment or another method to see what your Visual 2010 compiler says!!!
see you, jp