How to put a background sound to your Nw54-forum
In 5 Different ways
[ Please do not link to my files, you may use them by saving them to your own webspace. ]
Note: Background sound Can be very annoying!
And difficult to realize if you want to fit all browsers.
Many different ways to put sound to a webpage. A few examples here on this site.
Your board's visitors always should have the choice whether to have sound or not.
Best to realise having controls is shown here,
Above this text are three consols. You will see them with InternetExplorer, and depending on what Plugins you have with your browser.
As it's shown at the » Creator sound page there are some different paneel designs possible.
Examples above this page.
Script for the large console:
<script language="JavaScript">
<!-- //created on http://javascript.about.com/library/tools/blbgaudio.htm
var soundFile = "http://www.network54.com/Realm/Rat_Sound/cantstoplovingyou.mid";
if (soundFile.indexOf(",") > 0) {
var sounds = soundFile.split(",");soundFile = sounds[Math.floor(Math.random()*sounds.length)];
}
if(navigator.plugins.length>0){
if (navigator.mimeTypes["audio/mid"] && navigator.mimeTypes["audio/mid"].enabledPlugin) document.write('<embed src="'+soundFile+'" autostart="true" loop="true" controls="LargeConsole" width=145 height=35></embed>');
}
else {
document.write('<embed src="'+soundFile+'" autostart="true" loop="true" width=285 height=45></embed>');
}
//-->
</script>
<noscript>
<embed src="http://www.network54.com/Realm/Rat_Sound/cantstoplovingyou.mid" autostart="false" loop="true"></embed>
</noscript>
<noembed>
<bgsound src="http://www.network54.com/Realm/Rat_Sound/cantstoplovingyou.mid" loop=true>
</noembed>Actually you wouldn't need anything more for MSinternetExplorer-users but this part:
<bgsound src="http://www.network54.com/Realm/Rat_Sound/cantstoplovingyou.mid" loop=true width="140" height="60">but this will give you and your users No controlls, besides some other reasons.
Better results and a control paneel you'll have with this command:
<embed src="http://www.network54.com/Realm/Rat_Sound/cantstoplovingyou.mid" loop="false" height="45" width="340" autostart="false"> or this one:
<object data="http://www.network54.com/Realm/Rat_Sou
nd/cantstoplovingyou.mid">music</object>But let's start from the beginning
• How this script works
First of all you need a music-file, type mid, au, ra or wav ....
The file I have used for this page is a MID-type, 42kbyte in size.
The 'smaller' the file the faster the download to the listerner's browser.
It needs a place in the internet from where it is accessible.
Just your own pc won't do. You need webspace to upload any stored sound-file.
Presently Nw54 disallows uploading anything but pictures for free accounts;
Premier accounts are lucky here.
But you can use space from another homepage-provider or so, there are lots of webspace-providers out there.
Step Two
Now your sound-file is online. And its address, the source (src), is called URL.
If you like you may take that URL
http://www.network54.com/Realm/YourREALM/YourSOUND.mid
and paste it to the » Creator Sound Page . Choose the panel you prefer.
Autostart= true means your sound will start automatically.
You may also set this to false.
Loop=infinite Means what it says. Or choose true or the amount of loops.
Hidden
True or false. Your visitors will love the option to shut down
noice sound. This is also doable with "width" and "height" (set to "0" means hidden).
Your visitors least need a browsers with plugins, soundcard and -of course-
loudspeakers.
Depending on the browser's plugins the player will have a different look to others.
(I just had a strange experiment with Quicktime and RealPlayer ...)
• Part Two
Jukebox. Solution For All Browsers.
Due to KD here's another solution for this.She was using a Drop-Down-Menu for her Background Music.
That way her visitors are able to choose the title they are wanting to listen to.
It is working same as a link.
Example. Click this link: » ThePray.midi
If your browser is IE it will open your own installed player.
Newer Gecko-based browser (like Mozilla and Opera ...) will ask you if you like to open the file or if it shall be Safed As.. to your pc.
And here's the script for the Drop-Down-Menu
<select name="menu" style="font-size:12px;color:#FFFFFF;font-family:verdana;background-color:#006699;" onChange="if(this.options[this.selectedIndex].value) window.location=this.options[this.selectedIndex].value;">
<option value=none> Choose Your Sound </option>
<optgroup label="Jazz">
<option value="http://mitglied.lycos.de/RatEdHome/Soundz/Elvis_fever.mid">Fever<
/option>
</optgroup>
<optgroup label="Pop">
<option value="http://network54.com/Realm/Rat_Sound/leaving_home.mid">She's Leaving Home</option>
<option value="http://www.network54.com/Realm/Rat_Sound/cantstoplovingyou.mid">Can't Stop Loving U</option>
</optgroup>
</select>
• Part Three
MouseOver Links And A STOP BG-Sound-Option
(Alas for InternetExplorer only ! )
To be seen at the Test Forum. Go there, hover your mouse over the Music Links. Listen.
The script for the MouseOver-Menu
<bgsound src="#" id="music" loop=1 autostart="true">
<p><a href="#" onMouseOver="music.src='http://network54.com/Realm/Rat_Sound/leaving_home.mid'"> She'sLeavingHome</a></p>
<p><a href="#" onMouseOver="music.src='http://www.network54.com/Realm/Rat_Soun
d/cantstoplovingyou.mid'"> Can't Stop Loving You</a></p>
<p><a href="#" onMouseOver="music.src='http://www.network54.com/Realm/Rat_Sound/fever.mid'"> Fever</a></p>
<p><ul><a href="#" onMouseOver="music.src=''"> STOP BACKGROUND MUSIC</a></ul></p> There are some other ways to realise sound, which are here not listed. For example, sound via Flashplayer, streaming sound a.s.o.
• Part 4
This one opens a little Pop-up with the controls
<script language="JavaScript">
function midi(blah){
playwindow = window.open("","","directories=no,toolbar=no,width=160,height=70")
if(blah==1) {
var vamp="<EMBED SRC=http://www.rattarium.net/Soundz/cantstoplovingyou.mid width=144 height=60 panel=0 autostart=true loop=false>"
}
else if(blah==2) {
var vamp="<EMBED SRC=http://www.rattarium.net/Soundz/thepray.mid width=144 height=60 panel=0 autostart=true loop=false>"
}
playwindow.document.write ("<html><body onBlur='self.close()' bgcolor=#fff> "+ vamp +"</body></html>");
playwindow.document.close();
}
</script>
<form>
<table>
<tr>
<td><input class="ikon" TYPE="button" NAME="sound" VALUE="midi 1" onClick="midi(1)"></td>
<td><input class="ikon" TYPE="button" NAME="sound" VALUE="midi 2" onClick="midi(2)"></td>
<td><input class="ikon" TYPE="button" NAME="sound" VALUE="Close pop-up" onClick=""></td>
</tr>
</table>
Or the same as a simple link wrapped round an image:
<a class="ikon" href="javascript:midi(1)"><img src="sound.gif" height="14" alt="" /> midi 1</a>
</form>
And Yet Another One • Part 5
For Netcape and FireFox: This one displays Windows Media Player if installed (Thanks KD):
The Script
<OBJECT ID="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Versio
n=5,1,52,701"
STANDBY="Loading Microsoft Windows® Media Player components..." TYPE="applica
tion/x-oleobject" width="280" height="46">
<PARAM NAME="fileName" VALUE="">
<PARAM NAME="animationatStart" VALUE="false">
<PARAM NAME="transparentatStart" VALUE="true">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="showControls" VALUE="true">
<param name="Volume" value="-300">
<EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="" name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1 volume=-300>
</OBJECT>
Comprising is to say: Not every browser works with every script on this page.
Or works at least with any of the scripts. Not every user is too happy about
background music. So - if you have a sound make sure it is optional.
Didn't mention Flash scripts,
because I didn't use such yet - and will not in future, I guess.
1/2004 © Ed Home/BilgeRat

