Search
Sponsors

Posts Tagged ‘sound’

Random Midi

Friday, January 9th, 2009

Paste this into the <body> section

<script language=”Javascript”>
<!–
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

var currentdate = 0
var theranmidi = ” ”
var core = 0

function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ‘ ‘

  }
}

midi = new StringArray(10)
midi[0] = ‘midi1.mid’
midi[1] = ‘midi2.mid’
midi[2] = ‘midi3.mid’
midi[3] = ‘midi4.mid’
midi[4] = ‘midi5.mid’
midi[5] = ‘midi6.mid’
midi[6] = ‘midi7.mid’
midi[7] = ‘midi8.mid’
midi[8] = ‘midi9.mid’
midi[9] = ‘midi10.mid’

ran = 60 / midi.length
 
function ranmidi() {
  currentdate = new Date()
  core = currentdate.getSeconds()
  adcore = Math.floor(core/ran)
  core = adcore
    theranmidi = midi[core]
    return (theranmidi)
}

document.write(”RANDOM MIDI IS: <b>”+ranmidi()+”</b><br><br>”
+”<EMBED src=”+ranmidi()+” Width=200 Height=55 autostart=true hidden=true>”)

//–>
</script>

Mouseover Sound

Friday, January 9th, 2009

insert this into the <BODY> section

<script LANGUAGE=”JavaScript”><!–
var aySound = new Array();
// Below: source for sound files to be preloaded
aySound[0] = “sound1.wav”;
aySound[1] = “sound2.wav”;
// DO NOT edit below this line
IE = (navigator.appVersion.indexOf(”MSIE”)!=-1 && document.all)? 1:0;
NS = (navigator.appName==”Netscape” && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
onload=auPreload;
function auPreload() {
if (!ver4) return;
if (NS) auEmb = new Layer(0,window);
else {
Str = “<DIV ID=’auEmb’ STYLE=’position:absolute;’></DIV>”;
document.body.insertAdjacentHTML(”BeforeEnd”,Str);
}
var Str = ”;
for (i=0;i<aySound.length;i++)
Str += “<EMBED SRC=’”+aySound[i]+”‘ AUTOSTART=’FALSE’ HIDDEN=’TRUE’>”
if (IE) auEmb.innerHTML = Str;
else {
auEmb.document.open();
auEmb.document.write(Str);
auEmb.document.close();
}
auCon = IE? document.all.auIEContainer:auEmb;
auCon.control = auCtrl;
}
function auCtrl(whSound,play) {
if (IE) this.src = play? aySound[whSound]:”;
else eval(”this.document.embeds[whSound].” + (play? “play()”:”stop()”))
}
function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); }
function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); }
//–></script>
<a href=”#” onMouseOver=”playSound(0)” onMouseOut=”stopSound(0)”>sound 1</a>
<a href=”#” onMouseOver=”playSound(0)” onMouseOut=”stopSound(0)”>sound 2</a>

Translate