Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-28-2003, 01:56 AM   PM User | #1
Clem
New to the CF scene

 
Join Date: Sep 2003
Location: Florida
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Clem is an unknown quantity at this point
Question Random Midi Script

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.
__________________
Many Thanks for your kind help,
Clem
Clem is offline   Reply With Quote
Old 09-28-2003, 07:17 PM   PM User | #2
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
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/Will...iPlayer3.shtml

Last edited by Willy Duitt; 09-28-2003 at 07:21 PM..
Willy Duitt is offline   Reply With Quote
Old 09-29-2003, 03:07 AM   PM User | #3
Clem
New to the CF scene

 
Join Date: Sep 2003
Location: Florida
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Clem is an unknown quantity at this point
Thumbs up

Thanks Willy. This is what I was looking for. I will try it out this week. Have a good day.

Clem
Clem is offline   Reply With Quote
Old 09-29-2003, 03:27 AM   PM User | #4
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
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.

....Willy
Willy Duitt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:45 PM.


Advertisement
Log in to turn off these ads.