Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <button onclick="InstrumFx1();">FX</button>
- <script>
- function InstrumFx1(){
- var i=0;
- for(var i=0;i<5;i++){
- var audioCtx=new AudioContext();
- var oscillator = audioCtx.createOscillator();
- var gainNode = audioCtx.createGain();
- oscillator.connect(gainNode);
- gainNode.gain.value=0;
- gainNode.connect(audioCtx.destination);
- oscillator.type='2';
- oscillator.frequency.value=85+i;
- oscillator.start(i);
- if (gainNode.gain.value==1){
- gainNode.gain.value=0;
- }else{
- gainNode.gain.value=1;
- }
- gainNode.gain.value=i;
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement