Play .Wav (Wave) Files (1 Viewer)

Status
Not open for further replies.

ajetrumpet

Banned
Local time
Today, 16:16
Joined
Jun 22, 2007
Messages
5,638
Play VB/HTML .Wav (Wave) Files

Here is some code you can use to play .Wav files in your database:
Code:
Option Compare Database
Option Explicit

Public MusicPlay As Long

Public Const SND_SYNC = &H0

Public Const SND_NODEFAULT = &H2
 
Declare Function SndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
                (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Play your .Wav files using the "MusicPlay" variable:
Code:
Function PlayFile()

   MusicPlay = SndPlaySound("FULL PATH OF .WAV FILE", SND_SYNC + SND_NODEFAULT)

End Function
I incorporated some background voices on a website recently, so I'll add the small piece of code I used to play .Wav's on the webpages too...

This script goes before the BODY tags:
Code:
<script type="text/javascript">
function EvalSound(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Play();
}
</script>

<embed src="FULL PATH AND EXTENSION OF FILE" autostart=false loop="false" 
width=0 height=0 id="sound1" enablejavascript="true">
This is the start of the BODY tag:
Code:
<body onLoad="EvalSound('sound1');"
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom