...

View Full Version : Random Midi Script



Clem
09-28-2003, 02:56 AM
I searched the web for a script that would play MIDI files randomly or sequentially BUT without the need for the visitor to reload the page. I want the MIDI files to play automatically one after the other.

Can someone suggest me one or direct me to a site where I could find one.

Willy Duitt
09-28-2003, 08:17 PM
Here's a script which plays any number
of random midi's one after another.


<SCRIPT TYPE="text/javascript">
/*************************************
written by:WillyDuitt@hotmail.com
http://www.angelfire.com/art/img/


var numsong equals number of songs
midi=(your song url)
song=(your song title)
time=(number of seconds song plays)
URL=(your midiplayer addy)

**************************************/

var numsong=6
play=Math.round(Math.random()*numsong)
if (play == 1)
{
midi=("BlueJeans.mid")
song=("Baby Got Her Bluejeans On")
time=("200")
}
else if (play == 2)
{
midi=("BootSctn.mid")
song=("Boot Scootin'")
time=("200")
}
else if (play == 3)
{
midi=("GoodbyeEarl.mid")
song=("GoodBye Earl")
time=("250")
}
else if (play == 4)
{
midi=("HighwayMan.mid")
song=("Highway Man")
time=("180")
}
else if (play == 5)
{
midi=("Trouble.mid")
song=("There's Your Trouble")
time=("190")
}
else if (play == 6)
{
midi=("Wabash.mid")
song=("Wabash Cannonball")
time=("150")
}

document.write('<meta http-equiv="refresh" content="' + time + ';URL=http://YOUR MIDIPLAYER URL">');
document.write('<EMBED SRC= "' + midi + '" HIDDEN="TRUE" AUTOSTART="TRUE" LOOP="FALSE" VOLUME="100%">');
document.write('<br>Now Playing: ' + song + ' ');
</SCRIPT>


An example can be found here:
http://transload.net/~cyberrite/Willy/Codes/MidiPlayer3.shtml

Clem
09-29-2003, 04:07 AM
:) Thanks Willy. This is what I was looking for. I will try it out this week. Have a good day.

Clem

Willy Duitt
09-29-2003, 04:27 AM
Your Welcome :)

Let me know if you have any problems installing it. To prevent the page it appears on from "flashing" it should be put in a FRAME, IFRAME or external Javascript file.

Also, it could probably use BGSOUND support but I wrote that a year or so ago before I knew any better. :o

....Willy



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum