var context = null; var usingWebAudio = true; var gainNode = null; var source = null; var volume = 0.2;
var plan1 = [{freq:"3120", time:"60000"}];
var plan2 = [{freq:"342", time:"60000"}, {freq:"510", time:"60000"}, {freq:"778", time:"60000"}];
var plan3 = [{freq:"414", time:"60000"}, {freq:"464", time:"60000"}, {freq:"877", time:"60000"}, {freq:"866", time:"60000"}, {freq:"886", time:"60000"}, {freq:"254.2", time:"60000"}, {freq:"381", time:"60000"}, {freq:"661", time:"60000"}, {freq:"762", time:"60000"}, {freq:"742", time:"60000"}, {freq:"1151", time:"60000"}, {freq:"450", time:"60000"}];
var plan4 = [{freq:"304", time:"60000"}, {freq:"144", time:"60000"}, {freq:"1.2", time:"60000"}, {freq:"520", time:"60000"}];
var plan5 = [{freq:"20", time:"60000"}, {freq:"440", time:"60000"}, {freq:"880", time:"60000"}, {freq:"1552", time:"60000"}, {freq:"802", time:"60000"}, {freq:"832", time:"60000"}];
var plan6 = [{freq:"1550", time:"60000"}, {freq:"880", time:"60000"}, {freq:"802", time:"60000"}, {freq:"832", time:"60000"}, {freq:"787", time:"60000"}, {freq:"776", time:"60000"}, {freq:"422", time:"60000"}, {freq:"727", time:"60000"}, {freq:"20", time:"60000"}];
var plan7 = [{freq:"3.5", time:"60000"}, {freq:"800", time:"60000"}];
var plan8 = [{freq:"528", time:"60000"}, {freq:"731", time:"60000"}, {freq:"732", time:"60000"}];
var plan9 = [{freq:"3000", time:"60000"}, {freq:"95", time:"60000"}, {freq:"666", time:"60000"}, {freq:"80", time:"60000"}];
var plan10 = [{freq:"3000", time:"60000"}, {freq:"95", time:"60000"}, {freq:"10000", time:"60000"}, {freq:"1550", time:"60000"}, {freq:"802", time:"60000"}, {freq:"880", time:"60000"}, {freq:"787", time:"60000"}, {freq:"727", time:"60000"}, {freq:"690", time:"60000"}, {freq:"666", time:"60000"}];
var plan11 = [{freq:"880", time:"60000"}, {freq:"800", time:"60000"}, {freq:"832", time:"60000"}, {freq:"422", time:"60000"}, {freq:"2112", time:"60000"}, {freq:"787", time:"60000"}, {freq:"727", time:"60000"}, {freq:"20", time:"60000"}];
var plan12 = [{freq:"3.59", time:"60000"}, {freq:"3", time:"60000"}, {freq:"7.83", time:"60000"}, {freq:"10", time:"60000"}, {freq:"1550", time:"60000"}, {freq:"1500", time:"60000"}, {freq:"880", time:"60000"}, {freq:"802", time:"60000"}, {freq:"6000", time:"60000"}, {freq:"304", time:"60000"}];
var plan13 = [{freq:"1.2", time:"60000"}, {freq:"80", time:"60000"}];
var plan14 = [{freq:"646", time:"60000"}];
var plan15 = [{freq:"1550", time:"60000"}, {freq:"802", time:"60000"}, {freq:"880", time:"60000"}, {freq:"787", time:"60000"}, {freq:"776", time:"60000"}, {freq:"727", time:"60000"}, {freq:"125", time:"60000"}, {freq:"95", time:"60000"}, {freq:"72", time:"60000"}, {freq:"20", time:"60000"}, {freq:"444", time:"60000"}, {freq:"1865", time:"60000"}, {freq:"450", time:"60000"}];
var plan16 = [{freq:"1238", time:"60000"}, {freq:"1550", time:"60000"}, {freq:"1862", time:"60000"}, {freq:"802", time:"60000"}, {freq:"880", time:"60000"}, {freq:"787", time:"60000"}, {freq:"776", time:"60000"}, {freq:"727", time:"60000"}, {freq:"20", time:"60000"}, {freq:"450", time:"60000"}, {freq:"412", time:"60000"}, {freq:"766", time:"60000"}, {freq:"688", time:"60000"}, {freq:"683", time:"60000"}, {freq:"975", time:"60000"}, {freq:"2688", time:"60000"}, {freq:"660", time:"60000"}];
var plan17 = [{freq:"550", time:"60000"}, {freq:"802", time:"60000"}, {freq:"880", time:"60000"}, {freq:"787", time:"60000"}, {freq:"776", time:"60000"}, {freq:"727", time:"60000"}, {freq:"452", time:"60000"}, {freq:"1474", time:"60000"}, {freq:"578", time:"60000"}];
var plan18 = [{freq:"5500", time:"60000"}, {freq:"4400", time:"60000"}, {freq:"802", time:"60000"}, {freq:"787", time:"60000"}, {freq:"727", time:"60000"}, {freq:"720", time:"60000"}, {freq:"552", time:"60000"}, {freq:"440", time:"60000"}, {freq:"400", time:"60000"}, {freq:"125", time:"60000"}, {freq:"72", time:"60000"}, {freq:"800", time:"60000"}, {freq:"880", time:"60000"}];
var plan19 = [{freq:"652", time:"60000"}, {freq:"725", time:"60000"}, {freq:"746", time:"60000"}, {freq:"751", time:"60000"}, {freq:"768", time:"60000"}, {freq:"1110", time:"60000"}, {freq:"333", time:"60000"}, {freq:"666", time:"60000"}, {freq:"542", time:"60000"}, {freq:"522", time:"60000"}];
var plan20 = [{freq:"20", time:"60000"}, {freq:"120", time:"60000"}, {freq:"146", time:"60000"}, {freq:"440", time:"60000"}, {freq:"444", time:"60000"}, {freq:"465", time:"60000"}, {freq:"727", time:"60000"}, {freq:"776", time:"60000"}, {freq:"787", time:"60000"}, {freq:"880", time:"60000"}, {freq:"1500", time:"60000"}, {freq:"1550", time:"60000"}, {freq:"5000", time:"60000"}, {freq:"1000", time:"60000"}];
var plan21 = [{freq:"3176", time:"60000"}, {freq:"2489", time:"60000"}, {freq:"880", time:"60000"}, {freq:"800", time:"60000"}, {freq:"728", time:"60000"}];
var plan22 = [{freq:"7728", time:"60000"}, {freq:"4888", time:"60000"}, {freq:"8238", time:"60000"}, {freq:"2413", time:"60000"}, {freq:"880", time:"60000"}, {freq:"787", time:"60000"}, {freq:"776", time:"60000"}, {freq:"727", time:"60000"}, {freq:"440", time:"60000"}, {freq:"746", time:"60000"}, {freq:"567", time:"60000"}, {freq:"7880", time:"60000"}, {freq:"787", time:"60000"}, {freq:"300", time:"60000"}, {freq:"310", time:"60000"}, {freq:"1234", time:"60000"}, {freq:"9999", time:"60000"}]; var plan23 = [{freq:"10000", time:"60000"}, {freq:"7344", time:"60000"}, {freq:"333", time:"60000"}, {freq:"4412", time:"60000"}, {freq:"1550", time:"60000"}, {freq:"880", time:"60000"}, {freq:"802", time:"60000"}, {freq:"787", time:"60000"}, {freq:"776", time:"60000"}, {freq:"766", time:"60000"}, {freq:"727", time:"60000"}, {freq:"444", time:"60000"}, {freq:"20", time:"60000"}];
var plan24 = [{freq:"250", time:"60000"}, {freq:"465", time:"60000"}, {freq:"8210", time:"60000"}, {freq:"8700", time:"60000"}, {freq:"7760", time:"60000"}];
var plan25 = [{freq:"728", time:"60000"}, {freq:"784", time:"60000"}, {freq:"880", time:"60000"}, {freq:"20", time:"60000"}, {freq:"72", time:"60000"}, {freq:"120", time:"60000"}, {freq:"146", time:"60000"}, {freq:"400", time:"60000"}, {freq:"440", time:"60000"}, {freq:"464", time:"60000"}, {freq:"524", time:"60000"}, {freq:"548", time:"60000"}, {freq:"660", time:"60000"}, {freq:"712", time:"60000"}, {freq:"732", time:"60000"}, {freq:"802", time:"60000"}, {freq:"1500", time:"60000"}, {freq:"1552", time:"60000"}, {freq:"1600", time:"60000"}, {freq:"1862", time:"60000"}, {freq:"683", time:"60000"}];
var plan26 = [{freq:"125", time:"60000"}, {freq:"160", time:"60000"}, {freq:"367", time:"60000"}, {freq:"472", time:"60000"}, {freq:"600", time:"60000"}, {freq:"615", time:"60000"}, {freq:"625", time:"60000"}, {freq:"650", time:"60000"}, {freq:"820", time:"60000"}, {freq:"952", time:"60000"}, {freq:"1150", time:"60000"}, {freq:"1520", time:"60000"}, {freq:"1865", time:"60000"}, {freq:"2000", time:"60000"}, {freq:"4392", time:"60000"}, {freq:"4400", time:"60000"}, {freq:"4412", time:"60000"}];
var plan27 = [{freq:"60", time:"60000"}, {freq:"95", time:"60000"}, {freq:"128", time:"60000"}, {freq:"225", time:"60000"}, {freq:"414", time:"60000"}, {freq:"427", time:"60000"}, {freq:"432", time:"60000"}, {freq:"456", time:"60000"}, {freq:"610", time:"60000"}, {freq:"614", time:"60000"}, {freq:"618", time:"60000"}, {freq:"1234", time:"60000"}, {freq:"2600", time:"60000"}, {freq:"5500", time:"60000"}, {freq:"304", time:"60000"}];
var plan28 = [{freq:"453", time:"60000"}, {freq:"550", time:"60000"}, {freq:"674", time:"60000"}, {freq:"728", time:"60000"}, {freq:"786", time:"60000"}, {freq:"1109", time:"60000"}, {freq:"7160", time:"60000"}, {freq:"634", time:"60000"}, {freq:"639", time:"60000"}, {freq:"1089", time:"60000"}];
var plan29 = [{freq:"960", time:"60000"}, {freq:"727", time:"60000"}, {freq:"786", time:"60000"}, {freq:"453", time:"60000"}, {freq:"678", time:"60000"}, {freq:"674", time:"60000"}, {freq:"550", time:"60000"}, {freq:"1109", time:"60000"}, {freq:"424", time:"60000"}, {freq:"943", time:"60000"}, {freq:"1050", time:"60000"}, {freq:"643", time:"60000"}, {freq:"2600", time:"60000"}, {freq:"7160", time:"60000"}, {freq:"639", time:"60000"}, {freq:"1089", time:"60000"}, {freq:"8697", time:"60000"}];
var plan30 = [{freq:"2127", time:"60000"}, {freq:"2008", time:"60000"}, {freq:"880", time:"60000"}, {freq:"784", time:"60000"}, {freq:"727", time:"60000"}, {freq:"690", time:"60000"}, {freq:"676", time:"60000"}, {freq:"664", time:"60000"}, {freq:"125", time:"60000"}, {freq:"95", time:"60000"}, {freq:"72", time:"60000"}, {freq:"20", time:"60000"}, {freq:"3.9", time:"60000"}, {freq:"450", time:"60000"}, {freq:"802", time:"60000"}, {freq:"1552", time:"60000"}, {freq:"832", time:"60000"}, {freq:"422", time:"60000"}];
var plan31 = [{freq:"1266", time:"60000"}, {freq:"880", time:"60000"}, {freq:"848", time:"60000"}, {freq:"787", time:"60000"}, {freq:"784", time:"60000"}, {freq:"727", time:"60000"}, {freq:"875", time:"60000"}, {freq:"885", time:"60000"}, {freq:"2000", time:"60000"}];
var plan32 = [{freq:"2720", time:"60000"}, {freq:"47", time:"60000"}];
var plan33 = [{freq:"9918", time:"60000"}, {freq:"9740", time:"60000"}, {freq:"4959", time:"60000"}, {freq:"4870", time:"60000"}, {freq:"2479.5", time:"60000"}, {freq:"2435", time:"60000"}, {freq:"1394.7", time:"60000"}, {freq:"1369.6", time:"60000"}, {freq:"1239.7", time:"60000"}, {freq:"1217.5", time:"60000"}, {freq:"774.8", time:"60000"}, {freq:"760.9", time:"60000"}, {freq:"619.9", time:"60000"}, {freq:"608.7", time:"60000"}, {freq:"464.9", time:"60000"}, {freq:"456.5", time:"60000"}, {freq:"309.9", time:"60000"}, {freq:"304.4", time:"60000"}, {freq:"155", time:"60000"}, {freq:"152.2", time:"60000"}];
var plan34 = [{freq:"72", time:"60000"}, {freq:"95", time:"60000"}, {freq:"190", time:"60000"}, {freq:"880", time:"60000"}, {freq:"832", time:"60000"}, {freq:"787", time:"60000"}, {freq:"727", time:"60000"}, {freq:"20", time:"60000"}, {freq:"4.9", time:"60000"}];
var plan35 = [{freq:"10000", time:"60000"}, {freq:"880", time:"60000"}, {freq:"787", time:"60000"}, {freq:"727", time:"60000"}, {freq:"26", time:"60000"}];
var plan36 = [{freq:"26", time:"60000"}];
var plan37 = [{freq:"1550", time:"60000"}, {freq:"880", time:"60000"}, {freq:"832", time:"60000"}, {freq:"802", time:"60000"}, {freq:"786", time:"60000"}, {freq:"727", time:"60000"}, {freq:"465", time:"60000"}];
var plan38 = [{freq:"8", time:"60000"}, {freq:"1862", time:"60000"}, {freq:"2008", time:"60000"}, {freq:"2128", time:"60000"}, {freq:"2180", time:"60000"}, {freq:"3347", time:"60000"}, {freq:"5611", time:"60000"}, {freq:"2791", time:"60000"}, {freq:"3448", time:"60000"}, {freq:"2929", time:"60000"}, {freq:"4014", time:"60000"}, {freq:"5611", time:"60000"}, {freq:"2867", time:"60000"}, {freq:"2855", time:"60000"}, {freq:"432", time:"60000"}];
var plan40 = [{freq:"20", time:"60000"}, {freq:"10000", time:"60000"}];
var plan41 = [{freq:"728", time:"60000"}, {freq:"784", time:"60000"}, {freq:"880", time:"60000"}, {freq:"465", time:"60000"}, {freq:"20", time:"60000"}, {freq:"64", time:"60000"}, {freq:"72", time:"60000"}, {freq:"96", time:"60000"}, {freq:"112", time:"60000"}, {freq:"120", time:"60000"}, {freq:"125", time:"60000"}, {freq:"128", time:"60000"}, {freq:"152", time:"60000"}, {freq:"240", time:"60000"}, {freq:"334", time:"60000"}, {freq:"422", time:"60000"}, {freq:"442", time:"60000"}, {freq:"524", time:"60000"}, {freq:"651", time:"60000"}, {freq:"688", time:"60000"}, {freq:"732", time:"60000"}, {freq:"751", time:"60000"}, {freq:"800", time:"60000"}, {freq:"854", time:"60000"}, {freq:"1864", time:"60000"}];
var plan42 = [{freq:"120", time:"60000"}, {freq:"128", time:"60000"}, {freq:"422", time:"60000"}, {freq:"644", time:"60000"}, {freq:"676", time:"60000"}, {freq:"688", time:"60000"}, {freq:"689", time:"60000"}, {freq:"690", time:"60000"}, {freq:"712", time:"60000"}, {freq:"728", time:"60000"}, {freq:"732", time:"60000"}, {freq:"800", time:"60000"}, {freq:"801", time:"60000"}, {freq:"802", time:"60000"}, {freq:"1550", time:"60000"}, {freq:"1551", time:"60000"}, {freq:"1552", time:"60000"}, {freq:"1862", time:"60000"}, {freq:"1863", time:"60000"}, {freq:"1864", time:"60000"}, {freq:"2112", time:"60000"}, {freq:"4412", time:"60000"}];
var plan43 = [{freq:"47", time:"60000"}, {freq:"72", time:"60000"}, {freq:"80", time:"60000"}, {freq:"95", time:"60000"}, {freq:"120", time:"60000"}, {freq:"125", time:"60000"}, {freq:"440", time:"60000"}, {freq:"444", time:"60000"}, {freq:"465", time:"60000"}, {freq:"660", time:"60000"}, {freq:"665", time:"60000"}, {freq:"690", time:"60000"}, {freq:"727", time:"60000"}, {freq:"728", time:"60000"}, {freq:"740", time:"60000"}, {freq:"770", time:"60000"}, {freq:"780", time:"60000"}, {freq:"800", time:"60000"}, {freq:"880", time:"60000"}, {freq:"1840", time:"60000"}, {freq:"1865", time:"60000"}, {freq:"1998", time:"60000"}, {freq:"3176", time:"60000"}, {freq:"10000", time:"60000"}];
var plan44 = [{freq:"727", time:"60000"}, {freq:"787", time:"60000"}, {freq:"880", time:"60000"}, {freq:"10000", time:"60000"}];
var plan45 = [{freq:"2720", time:"60000"}, {freq:"880", time:"60000"}, {freq:"787", time:"60000"}, {freq:"727", time:"60000"}, {freq:"220", time:"60000"}, {freq:"190", time:"60000"}, {freq:"20", time:"60000"}, {freq:"40", time:"60000"}];
if (typeof AudioContext !== 'undefined') { context = new AudioContext(); context.type = 'sine'; } else if (typeof webkitAudioContext !== 'undefined') { context = new webkitAudioContext(); } else { usingWebAudio = false; }
var playing = false; var osc = null; var freq = 174;
function toggle() { var button = document.getElementById("toggle"); if (playing && osc) { playing = false; osc.stop(0); button.value = "Play"; if (timeOutFunciton) { clearTimeout(timeOutFunciton); } } else { playing = true; gainNode = context.createGain(); //gainNode.connect(context.destination); gainNode.gain.setValueAtTime(volume, context.currentTime); // updateVol(volume); osc = context.createOscillator(); osc.connect(gainNode); gainNode.connect(context.destination); //osc.frequency.value = freq; myFunction(); osc.start(0); button.value = "Stop"; } if (timeOutFunciton) { clearTimeout(timeOutFunciton); } }
var idInPlan = 0; var planInPlay = null; function myFunction() {
var x = document.getElementById("mySelect").value; if (x == "plan1" && playing){ console.log("start plan1"); planInPlay = plan1; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; }
if (x == "plan2" && playing){ console.log("start plan2"); planInPlay = plan2; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan3" && playing){ console.log("start plan3"); planInPlay = plan3; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan4" && playing){ console.log("start plan4"); planInPlay = plan4; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan5" && playing){ console.log("start plan5"); planInPlay = plan5; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan6" && playing){ console.log("start plan6"); planInPlay = plan6; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan7" && playing){ console.log("start plan7"); planInPlay = plan7; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan8" && playing){ console.log("start plan8"); planInPlay = plan8; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan9" && playing){ console.log("start plan9"); planInPlay = plan9; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan10" && playing){ console.log("start plan10"); planInPlay = plan10; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan11" && playing){ console.log("start plan11"); planInPlay = plan11; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan12" && playing){ console.log("start plan12"); planInPlay = plan12; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan13" && playing){ console.log("start plan13"); planInPlay = plan13; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan14" && playing){ console.log("start plan14"); planInPlay = plan14; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan15" && playing){ console.log("start plan15"); planInPlay = plan15; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan16" && playing){ console.log("start plan16"); planInPlay = plan16; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan17" && playing){ console.log("start plan17"); planInPlay = plan17; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan18" && playing){ console.log("start plan18"); planInPlay = plan18; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan19" && playing){ console.log("start plan19"); planInPlay = plan19; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan20" && playing){ console.log("start plan20"); planInPlay = plan20; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan21" && playing){ console.log("start plan21"); planInPlay = plan21; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan22" && playing){ console.log("start plan22"); planInPlay = plan22; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan23" && playing){ console.log("start plan23"); planInPlay = plan23; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan24" && playing){ console.log("start plan24"); planInPlay = plan24; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan25" && playing){ console.log("start plan25"); planInPlay = plan25; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan26" && playing){ console.log("start plan26"); planInPlay = plan26; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan27" && playing){ console.log("start plan27"); planInPlay = plan27; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan28" && playing){ console.log("start plan28"); planInPlay = plan28; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan29" && playing){ console.log("start plan29"); planInPlay = plan29; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan30" && playing){ console.log("start plan30"); planInPlay = plan30; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan31" && playing){ console.log("start plan31"); planInPlay = plan31; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan32" && playing){ console.log("start plan32"); planInPlay = plan32; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan33" && playing){ console.log("start plan33"); planInPlay = plan33; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan34" && playing){ console.log("start plan34"); planInPlay = plan34; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan35" && playing){ console.log("start plan35"); planInPlay = plan35; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan36" && playing){ console.log("start plan36"); planInPlay = plan36; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan37" && playing){ console.log("start plan37"); planInPlay = plan37; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan38" && playing){ console.log("start plan38"); planInPlay = plan38; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan40" && playing){ console.log("start plan40"); planInPlay = plan40; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan41" && playing){ console.log("start plan41"); planInPlay = plan41; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan42" && playing){ console.log("start plan42"); planInPlay = plan42; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan43" && playing){ console.log("start plan43"); planInPlay = plan43; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan44" && playing){ console.log("start plan44"); planInPlay = plan44; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; } if (x == "plan45" && playing){ console.log("start plan45"); planInPlay = plan45; console.log(planInPlay[idInPlan]); idInPlan = 0; updateFreq(planInPlay[idInPlan].freq); setTimeout(updatePlan, planInPlay[idInPlan].time) return; }
if (timeOutFunciton) { clearTimeout(timeOutFunciton); } updateFreq(x.replace("Hz", "")); }
var timeOutFunciton = null; function updatePlan(){ console.log("intra"); idInPlan = idInPlan + 1; console.log(idInPlan); console.log(planInPlay.length); console.log(planInPlay[idInPlan]); if (idInPlan <= planInPlay.length - 1){ updateFreq(planInPlay[idInPlan].freq); timeOutFunciton = setTimeout(updatePlan, planInPlay[idInPlan].time); } else{ idInPlan = 0; planInPlay = null; clearTimeout(timeOutFunciton); playing = false; osc.stop(0); button.value = "Play"; } } function updateVol(vol){ //gainNode.offset.value = vol; volume = vol; document.getElementById('volumeText').innerText = 'Volum: ' + (parseInt(parseFloat(vol * 100).toFixed(2))+ ' -se poate regla si dupa inceperea muzicii' ); if (gainNode) { gainNode.gain.setValueAtTime(vol, context.currentTime); } } function updateFreq(newFreq) { if (timeOutFunciton) { clearTimeout(timeOutFunciton); } freq = newFreq; if (osc) { osc.frequency.value = freq; } //var text = document.getElementById("freqText").value = freq; //var range = document.getElementById("freqRange").value = freq; } window.onload = function() { var vol = volume * 100; document.getElementById('volumeText').innerText = 'Volum: ' + vol + ' -se poate regla si dupa inceperea muzicii' ; if (!usingWebAudio) { document.getElementById("audioControls").innerHTML = "
Web audio required.
" } }
const selectElement = document.querySelector('.ice-cream');
selectElement.addEventListener('change', (event) => { const result = document.querySelector('.result'); result.textContent = `You like ${event.target.value}`; });