Use these to select an area of my site



PROGRAMMING

DOCUMENTATION

SOFTWARE

UCF

Random Music

This page uses VBScript to illustrate random playing of one of five MIDI files. Hit your browser's refresh button to get a new sound. Some of the sounds are low, you may have to adjust your volume.

The list below allows you to launch a particular MIDI file into the player that you have on your PC.

Notes

  • You need a sound card in your PC.
  • You need a enable sounds in your browser.
  • I would like to find a way to allow a new sound to be played via a button rather that using the browser's refresh function.

Code Details

<script language = "vbscript">
<!-- To hide VBScript code from browsers that do not support it.

' Make sure you place this script after the BODY statement in your HTML document
' This script is set up to randomly pick between 5 midi files.
' Just rename the music(1 to 5).mid to the different names of your midi files below.
' You don't need to include the path unless the midi files aren't in the same
' directory as this script.
'
Dim snd(5)
dim sound
dim sHtml
snd(0)="bigsur.mid"
snd(1)="canyon.mid"
snd(2)="passport.mid"
snd(3)="pwaves.mid"
snd(4)="dcanon.mid"

function rand4()
      randomize
      rand4 = -1
      while rand4 <0 or rand4 > 4
         rand4 = int(rnd*5)
      wend
end function

sound = snd(rand4())
sHtml = "<bgsound src= " & chr(34) & sound & chr(34) & " loop=infinite>"
document.write sHtml
-->
</script>

Home Page | Personal | Professional | What's New | Hot Sites | Search | Write Us