plz culd sum1 help me with my problem.
when i enter my webpage,i want music to play for a certain amount of time.
prob is i don't know how to go about doing this.
i have winamp3 and some music downloaded into my file so what do i do next?
Printable View
plz culd sum1 help me with my problem.
when i enter my webpage,i want music to play for a certain amount of time.
prob is i don't know how to go about doing this.
i have winamp3 and some music downloaded into my file so what do i do next?
This is the way that I would do it but I suspect that you'll also want to preload the sound file othewise your script may tell it to stop playing before it's even loaded/started:Bear in mind however that I've only tested this in IE so it may not be cross-browser compatible.Code:<html>
<head>
<script type="text/javascript">
<!--
var mychoonz="tiki4.mp3"; // File name
var choonz_length=10000; // Milliseconds
function start_sound(){
document.getElementById('soundz').src=mychoonz;
window.setTimeout('stop_sound();', choonz_length);
}
function stop_sound(){
document.getElementById('soundz').src="#";
}
//-->
</script>
</head>
<body onLoad="start_sound();">
<bgsound id="soundz" src="#" autostart="true">
</body>
</html>
You may want to search Google for the "Embed" tag and investigate further.
Of course, the easiest way to play music for a fixed length of time is to crop the music file to the length that you want with an editor.
Andy
guess ur prob getting sick of me!
but am do i have the right player downloaded its name
is winamp3_0-full
and the music file is music1.ram
didn't work for me, so was thinking that i have wrong player downloaded but not sure
".ram" files are for RealPlayer.
so what kind of file can i use
the full name of the player file i want to use is
winamp3_0-full.zip
and music i have is music1.ram.
if ram won't work what kind of music file can i use
and is the player file alright!!!!!!!
You can either download Real Player to play the ram file, or use any one of a number od other audio files- mp3 probably being the most common.
To see what file types Winamp will play, go to options>file types.
mp3s and midi files are best for webapges (nice and small file format).
try www.flashkit.com and look for a link called loops, they've got some great short looping sound files!
Also you may want to look at <bgsound> instead of java, you can also embed stuff but i can't remember how :rolleyes:. You CAN embed ram files.
RAM FILES:
http://www.psiweb-guide.aa.psiweb.co...ediaindex.html
BGSOUND:
http://msdn.microsoft.com/library/de...ts/bgsound.asp
sorry about this but it is my first time trying to add music onto a website and i'm absolutely lost.
have the player downlaoded(i think) called winamp3.zip
have music downloaded music01.wav
so plz can sumone write the code for it to execute.
<script language="Javascript" >
var mychoonz="music01.wav"; // File name
var choonz_length=10000; // Milliseconds
function start_sound()
{
document.getElementById('soundz').src=mychoonz;
window.setTimeout('stop_sound();', choonz_length);
}
function stop_sound()
{
document.getElementById('soundz').src="winamp3.zip";
}
</script>
<body onLoad="start_sound();">
<bgsound id="soundz" src="winamp3.zip" autostart="true">
it won't work, this is similar to what awestmoreland did
for the love of god, PLEASE, no BG music on ANY website
Agreed. You may as well just replace the sound stuff with window.close as teh effect will probably be the same.
well, i still don't know how to go about doing it.
prac banging my head against the wall.
can anyone help
<script language="Javascript" >
var mychoonz="music.wav"; // File name
var choonz_length=10000; // Milliseconds
function start_sound()
{
document.getElementById('soundz').src=mychoonz;
window.setTimeout('stop_sound();', choonz_length);
}
function stop_sound()
{
document.getElementById('soundz').src="winamp3.zip";
}
</script>
<body onLoad="start_sound();">
<embed src="music.wav" hidden=true autostart=true>
<noembed>
<bgsound src="music.wav">
</noembed>
*** where is that i am wrong***
the music file is called music.wav and the player is called winamp3.zip. have i them in the wrong place?
can anyone help.
people above told me not include bgsound but the best i have looked up does include it.
first, you MUSt promise to include on"off" button, or no code
ok choi-rho, on-off button it is then
i think it would be one of these...
\<!-- ONE STEP TO INSTALL RANDOM MIDI:
1. Paste the coding into the BODY of your HTML document -->
<!-- STEP ONE: Put this code into the BODY of your HTML document -->
<BODY>
<CENTER>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
nummidi = 3
day = new Date()
z = day.getTime()
y = (z - (parseInt(z/1000,10) * 1000))/10
x = parseInt(y/100*nummidi,10) + 1
if (x == (1))
midi=("mid1.mid")
if (x == (2))
midi=("mid2.mid")
if (x == (3))
midi=("mid3.mid")
document.write('<EMBED SRC= ' + midi + ' autostart=true loop=true ')
document.write('volume=100 align="center" width=50 height=15 controls=smallconsole>')
// End -->
</SCRIPT>
</CENTER>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 0.83 KB -->
you might also be interested in this one::
http://javascript.internet.com/misce...midi-menu.html
netscape::
<BGSOUND SRC="yourmidifile.mid"><!--For IE -->
<EMBED SRC="yourmidifile.mid" HIDDEN="True"><!--
i could be wrong. I probably am. but that's ooakay, as bg music is evil anyways^_^
He He, DittoQuote:
Originally posted by Chi-Rho
for the love of god, PLEASE, no BG music on ANY website
If you are going to include sound in your webpage and you are going to instruct it to start automatically you should clearly give the user the option to stop the music playing also.
Some people HATE!!!! when music starts playing on a webpage me included (mainly because the music has no emphises or relevance to the page that its on).
Secondly if you are developing a page so that music will always play your best bet is to use a .wav file, now hold on yes a .wav file is the largest type of file to contain music in (as far as I know) but it is almost certian to run on most users machines. And using another file type will most certianly require a user to have a particular plug-in to hear the music so if that is the case it is wise to provide a link to where they are \ would be able to aquire the needed plug-in.
ok I hope that these comments aid you in your delima
tanx for that choi-roi, its working a treat.
but just wondering,instead of where u know there's a different tune
playing at a certain time of day,the user could have a choice of what midi files he/she wants to listen to.
do u know how to go about that.
if not,its ok
you mean this?
http://javascript.internet.com/misce...midi-menu.html
thanks a lot,it works a treat
;)
Here is an easy embedded music, play/pause and stop buttons javascript
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
i = 2;
function swap() {
switch (i) {
case 1:
play_pause.src = "pause.gif"
document.tester.play()
i = 2
return(false);
case 2:
play_pause.src = "play.gif"
document.tester.pause()
i = 1
return(false);
}
}
function stopit()
{document.tester.stop(); play_pause.src = "play.gif"; i=1}
</script>
</head>
<body>
<EMBED NAME="tester" SRC="soundtrack.mp3" loop="true" MASTERSOUND HIDDEN=TRUE autostart=true>
<img name="play_pause" onClick="swap()" src="pause.gif"/>
<img src="stop.gif" onClick="stopit()"/>
</body>
</html>
Let's hope no one tells you unless you are the only person who will ever visit your site. If you want anyone else to this is, in my opinion, simply an abusive practice.Quote:
Originally Posted by wanderlywagon
What if I'm happily listenting to something I find sublime and moving and I go to your page and you interrupt it with some dreck? Or what if I'm in an office and you make me subject my fellow workiers to your particular choice of dreck?
Please, unless you are the only one who will ever visit your site, just don't do it.