Microsoft Developer Network >
Página principal de foros
>
Visual Basic General
>
Visual basic 2005 sound midi mp3 or wav files?
Visual basic 2005 sound midi mp3 or wav files?
- How would I incorporate sound into a program? For instance a starting form then within the body of the program? Would I need to use a timer or is a midi file usable as it is?
Respuestas
- Hi,This is how to play WAVE *.wav files.Choose between;My.Computer.Audio.Play(ofd.FileName, AudioPlayMode.Background)orMy.Computer.Audio.Play(ofd.FileName, AudioPlayMode.BackgroundLoop)orMy.Computer.Audio.Play(ofd.FileName, AudioPlayMode.WaitToComplete)This works with Windows XP. :-) ;-)I'm not sure if VISTA still has a media folder containing WAVE files.Add 1 button to a FORM to try this code please.ofd.FileName here is the full path and filename returned from the OpenFileDialog.Option Strict OnPublic Class Form1Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickDim ofd As New OpenFileDialogofd.InitialDirectory = "C:\Windows\media"ofd.Filter = "Wave files only|*.wav"Tryofd.ShowDialog()My.Computer.Audio.Play(ofd.FileName, AudioPlayMode.Background)Catch ex As ExceptionMessageBox.Show(ex.ToString)End TryEnd SubEnd ClassRegards,John
- EditadoJohn Anthony Oliver sábado, 28 de junio de 2008 10:10Added an explanation.
- Marcado como respuestaturkeygizzard sábado, 28 de junio de 2008 18:14
Todas las respuestas
Hallo
bin gerade selbst auf der Suche, hab dabei diese Seite gefunden:
http://msdn.microsoft.com/de-de/library/bb978298.aspx
Mal sehen, ob ich die Beispiele (auf den Nachbarseiten) anwenden kann.
Gruß
Bingo_hb- Hi ALL,Here is a rough translation of the above using http://www.freetranslation.com/ >>>>___________________________________________________Hello Am just even on the search, found at the same time this side: http://msdn.microsoft.com/de-de/library/bb978298.aspxSee time whether I can use the examples (on the neighbor sides). Greeting Bingo_hb___________________________________________________Regards,John
- EditadoJohn Anthony Oliver sábado, 28 de junio de 2008 9:24....
- Hi Microsoft staff,Can we have this article in ENGLISH please?I've tried.>>and
- EditadoJohn Anthony Oliver sábado, 28 de junio de 2008 9:33....
- EditadoJohn Anthony Oliver sábado, 28 de junio de 2008 9:34....
- EditadoJohn Anthony Oliver sábado, 28 de junio de 2008 9:36....
- EditadoJohn Anthony Oliver sábado, 28 de junio de 2008 9:39....
- EditadoJohn Anthony Oliver sábado, 28 de junio de 2008 9:40Deleted a bit of extraneous text.
- EditadoJohn Anthony Oliver sábado, 28 de junio de 2008 9:48Added another possible ENGLISH url link.
- Hi,This is how to play WAVE *.wav files.Choose between;My.Computer.Audio.Play(ofd.FileName, AudioPlayMode.Background)orMy.Computer.Audio.Play(ofd.FileName, AudioPlayMode.BackgroundLoop)orMy.Computer.Audio.Play(ofd.FileName, AudioPlayMode.WaitToComplete)This works with Windows XP. :-) ;-)I'm not sure if VISTA still has a media folder containing WAVE files.Add 1 button to a FORM to try this code please.ofd.FileName here is the full path and filename returned from the OpenFileDialog.Option Strict OnPublic Class Form1Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickDim ofd As New OpenFileDialogofd.InitialDirectory = "C:\Windows\media"ofd.Filter = "Wave files only|*.wav"Tryofd.ShowDialog()My.Computer.Audio.Play(ofd.FileName, AudioPlayMode.Background)Catch ex As ExceptionMessageBox.Show(ex.ToString)End TryEnd SubEnd ClassRegards,John
- EditadoJohn Anthony Oliver sábado, 28 de junio de 2008 10:10Added an explanation.
- Marcado como respuestaturkeygizzard sábado, 28 de junio de 2008 18:14
- danke shein
I only know how to spaek a few words in German. Thankyou for your help but I wasn't able to view the library yet. Thanks anyway I appreciate all the help I can get!!!
~turkey~ - Thankyou John I appreciate your help. I'm really interested in midi files right now. I will look at the url you gave but it has to be in English!!! Thankyou so much for your help.
~turkey~

