How to Make a Frame-based Crescendo Jukebox
JavaScript for "Follow Around Sound"
- makes Crescendo come up in a separate window
JavaScript that *randomly* selects a MIDI file
CGI script that *randomly* selects a MIDI file
How to play music while your page is loading
Music playing while a web page is loading is nice. To get your music playing soonest, place your Crescendo HTML tags at the top of your document, like this one.
Use type 0 MIDI files for fastest playing with Crescendo PLUS
A type 0 MIDI file has the notes time-ordered in the file. Thus, when you use this type of MIDI file in your web pages, Crescendo PLUS users will hear the music start faster than with Type 1 MIDI files.
Seen at http://www.midwest.net/scribers/mccoy
Written by David McCoy.
Email comments and questions to mccoy@midwest.net
This is an updated version of the script, sent by David McCoy on 10/14/96:
<SCRIPT> <!-- close your eyes // David McCoy; mccoy@midwest.net URL: http://www.midwest.net/scribers/mccoy/ // This is my random midi picker (v3.0); If use a variant of this in your page, then // please email me :) You may also have to alter the links in the EMBED line so your // browser can "find" your MIDI files. such as: document.write('<EMBED SRC= // "http://www.server.com/page/' + midi + '" WIDTH=200 HEIGHT=60 AUTOSTART=TRUE>') // var nummidi is the number of MIDIs you will be using var nummidi = 5 day = new Date() seed = day.getTime() ran = parseInt(((seed - (parseInt(seed/1000,10) * 1000))/10)/100*nummidi + 1,10) if (ran == (1)) midi=("midi1.mid") if (ran == (2)) midi=("midi2.mid") if (ran == (3)) midi=("midi3.mid") if (ran == (4)) midi=("midi4.mid") if (ran == (5)) midi=("midi5.mid") document.write('<EMBED SRC= "' + midi + '" WIDTH=144 HEIGHT=60 AUTOSTART=TRUE>') document.write('<BGSOUND SRC= "' + midi + '" loop=infinite AUTOSTART=TRUE>') // open your eyes --> </SCRIPT>
Seen at http://isis.infinet.com/koolkat/
Written by Wm. Todd Horch.
Email comments and questions to whorch@ee.net
(A message from Todd: mention that since the src="..." can be any valid http based URL, it is entirely possible to use a CGI script to liven things up a bit. I've added a very simple script to one of my pages that returns a random MIDI song each time the page is first pointed to with Netscape. (i.e. the first time you point at a page after opening Netscape. Subsequent reloads in the same session will not load a new song unless you clear your cache or have Verify Documents set to Every Time on the Network Preferences page))
and the script is:
###############################################################################
# randmidi.pl - deliver random MIDI file to WWW page
###############################################################################
#!/usr/local/bin/perl
@songlist=("Song1.mid","Song2.mid","Song3.mid","Song4.mid","Song5.mid");
$song="/path/to/midi/files/$songlist[rand(@songlist)-1]";
open(MIDIFILE, $song);
print "Content-type: audio/midi\n\n";
while (read(MIDIFILE, $buf, 16384))
{print $buf;}
###############################################################################
Of course, this script could be expanded to allow something like: <embed src="http://www.yourserver.com/cgi-bin/randmidi.pl/path/to/midi/files" width=200 height=55> to be used to read the directory at the selected path and pick a random song from there.
JavaScript for "Follow
Around Sound"
Had it with Crescendo blanking your web page when you click on a link to a MIDI file? Here's the solution: a simple HTML JavaScript that launches Crescendo or Crescendo PLUS in a separate window, where it will continue to play music while you surf!
Works on both Netscape and Microsoft!
Here's our example code - simple, isn't it?
<SCRIPT LANGUAGE="JavaScript">
<!--
function PlaySong(SongURL) // Copyright (C) 1996 LiveUpdate division of
LABTECH
//
Permission for use granted to all music lovers on the net
{
PopUp = window.open (SongURL, "Crescendo", "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizeable=no,copyhistory=no,width=200,height=30")
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<P>LiveUpdate Crescendo Javascript for "Follow-Around Sound"</P>
<P>Note: This script works on both Netscape Navigator 3.0 and Microsoft Internet Explorer 3.0</P>
<P>Web authors - examine and make free use of this simple script!</P>
<A HREF="javascript: PlaySong('midi/xliveup1.mid')">Play
MIDI file by Peter Vantine<A><BR>
<A HREF="javascript: PlaySong('midi/xliveup3.mid')">Play
a different MIDI file by Peter Vantine<A><BR>
<A HREF="javascript: PlaySong('midi/xliveup4.mid')">Play
yet another MIDI file by Peter Vantine<A><BR>
</BODY>
</HTML>
Special thanks to Raymond Bissonnette, who created the first version of this example, in VBScript.
Here's a link to a page so you can operate the sample code. Go to town!
Have you ever tried to use a "midi jukebox" that blanked out
your screen, or even created a whole new Netscape or Internet Explorer
window? Finally, here is an alternative way to make a real, totally functional
jukebox that anyone can code! No scripting or Java applets are involved.
Just real, easy to use HTML programming.
All you need is Crescendo, and a page with one tiny frame. Here's how to
do it:
First, write the code to format a page with a small frame at the top, like
this:
<HTML> <html><head><title>My Homepage</title></head> <frameset rows="5,*"> {A} <frame name="_spanel" src="Panel.html" scrolling="off"> {B} <frame name="_main" src="Main.html" scrolling="auto"> {C} </frameset> <NOFRAMES> Sorry, you need a frame viewer for full jukebox support.<BR> {D} Click here to <A HREF="Main.html"> see the page </A> with no frames. </HTML>
Choose your background music here!<BR> <A HREF="midi/xliveup1.mid" target="_spanel">Play MIDI file by Peter Vantine</A><BR> <A HREF="midi/xliveup3.mid" target="_spanel">Choose another!</A><BR> <A HREF="midi/xliveup4.mid" target="_spanel">Or try this one!</A><BR>