
PLaying multiple .WAV files when page loads
Quote:
> I want to create a dynamic HTML page that displays a series of
> instructional statements that are associated with .WAV files that
> 'speak' the same words as the text. Each section of text will have
> its own .WAV file.
> Is there a way that I can play a series of .WAV files when the page
> loads. Could this be done through a VBScript function and then have
> the OnLoad call the function. Is there an equivilant to the Windows
> sndPlaySound function that I can use within a VBScript function?
> Any help appreciated.
> -Shawn
See the attached VB Script for a sound subroutine. This may give you
enough of an idea to accomplish your task.
Dim wshSound ' Sound Object Copy to your script main function
Dim SoundArray(15) ' Copy to your Script main function
Dim SoundNum ' Copy to your Script main function
Public Sub InitSound() ' Append to the end of your Script main
function
' Initialize sound files. ** The list may be changed based upon
your sounds. **
' ** Note: If available to others, keep it simple. **
' ** The list may include music and videos when using mplayer2. **
SoundArray(0) = "\media\Start.wav"
SoundArray(1) = "\media\ringout.wav"
SoundArray(2) = "\media\ringin.wav"
SoundArray(3) = "\media\chimes.wav"
SoundArray(4) = "\media\chord.wav"
SoundArray(5) = "\media\ding.wav"
SoundArray(6) = "\media\tada.wav"
SoundArray(7) = "\media\The Microsoft Sound.wav"
SoundArray(8) = "\phasers.wav"
SoundArray(9) = "\media\Office97\Reminder.wav"
SoundArray(10) = "\media\Office97\Type.wav"
SoundArray(11) = "\media\Office97\Whoosh.wav"
SoundArray(12) = "\media\Office97\Laser.wav"
SoundArray(13) = "\media\Office97\Camera.wav"
SoundArray(14) = "\media\Office97\Driveby.wav"
Set wshSound = CreateObject("WScript.Shell")
End Sub
Public Sub MakeSound(byVal SoundNum) ' Append to the end of your
Script main function
Dim WaveFile
WaveFile = "%windir%" & SoundArray(SoundNum)
wshSound.Run "sndrec32 /play /close " & WaveFile, -1, False ' Use
this one for .wav files only
' wshSound.Run "mplayer2 /play /close " & WaveFile, -1, False ' Use
this one for any media file
' -1 indicates no window shown, False
indicates release and continue immediately
0 indicates window shown, True indicates wait For completion to
continue
End Sub