BrU32

JS Web Audio API FX 2

Jul 21st, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. <button onclick="InstrumFx1();">FX</button>
  2. <script>
  3. var i=1.0;
  4. function InstrumFx1(){
  5. for(var i=0;i<555;i++){
  6. var audioCtx=new AudioContext();
  7. var oscillator = audioCtx.createOscillator();
  8. var gainNode = audioCtx.createGain();
  9. oscillator.connect(gainNode);
  10. gainNode.gain.value=0;
  11. gainNode.connect(audioCtx.destination);
  12. oscillator.type='2';
  13. oscillator.frequency.value=i;
  14. oscillator.start(i);
  15. gainNode.gain.value=i;
  16. i+=1;
  17. }
  18. }
  19. </script>
Advertisement
Add Comment
Please, Sign In to add comment