Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body onload="chk4.checked=true;
- Text1.value=Math.floor(Math.random()*100);
- Text2.value=Math.floor(Math.random()*100);" bgcolor="lightblue"/>
- <b>
- <font color="darkblue">
- <center>
- Time:(Seconds)<br>
- <input type="text" id="Text1" name="Text1" value="100">
- <br>Frequency:<br>
- <input type="text" id ="Text2" name="Text2" value="100">
- <br>
- <input type="checkbox" id="chk1" name="chk1" onclick="script:chk2.checked=false;
- chk3.checked=false;
- chk4.checked=false;"> Triangle
- <input type="checkbox" id="chk2" name="chk2" onclick="script:chk1.checked=false;
- chk3.checked=false;
- chk4.checked=false;"> Square
- <input type="checkbox" id="chk3" name="chk3" onclick="script:chk1.checked=false;
- chk2.checked=false;
- chk4.checked=false;"> Sine
- <input type="checkbox" id="chk4" name="chk4" onclick="script:chk1.checked=false;
- chk2.checked=false;
- chk3.checked=false"> Saw
- <br>
- <b>
- <button onclick="script:
- var PlayLen=Text1.value;
- var Freq=Text2.value;
- var context = new AudioContext();
- oscillator=context.createOscillator();
- if(chk1.checked==true){
- oscillator.type = 'triangle';
- }
- if(chk2.checked==true){
- oscillator.type = 'square';
- }
- if(chk3.checked==true){
- oscillator.type = 'sine';
- }
- if(chk4.checked==true){
- oscillator.type = 'sawtooth';
- }
- oscillator.frequency.value = Freq;
- oscillator.connect(context.destination);
- oscillator.start(context.current);
- oscillator.stop(PlayLen);
- oscillator.disconnect(PlayLen);"><b><font color=darkblue>Play Sound</button>
- <button onclick="script:
- var PlayLen=Text1.value;
- var Freq=Text2.value;
- var context = new AudioContext();
- oscillator=context.createOscillator();
- if(chk1.checked==true){
- oscillator.type = 'triangle';
- }
- if(chk2.checked==true){
- oscillator.type = 'square';
- }
- if(chk3.checked==true){
- oscillator.type = 'sine';
- }
- if(chk4.checked==true){
- oscillator.type = 'sawtooth';
- }
- var var1=Math.floor(Math.random()*100);
- var var2=Math.floor(Math.random()*100);
- var PlayLen=var1
- var Freq=Text1.var2;
- Text1.value=var1;
- Text2.value=var2;
- oscillator.frequency.value = Freq;
- oscillator.frequency.value = Freq;
- oscillator.connect(context.destination);
- oscillator.start(0);
- oscillator.stop(PlayLen);
- oscillator.disconnect(PlayLen);"><b><font color=darkblue>Gen Random</button>
- <button onclick="script:
- Text1.value='100';
- Text2.value='100';
- oscillator.stop(0);
- oscillator.disconnect(context.destination);"><b><font color=darkblue>Stop Sound</button>
- <button onclick="script:chk1.checked=false
- chk2.checked=false
- chk3.checked=false
- chk4.checked=false
- Text1.value='';
- Text2.value='';"><font color=darkblue><b>Clear All</button>
- </center>
Advertisement
Add Comment
Please, Sign In to add comment