BrU32

JS Web Audio Oscillator Wasp Swarm Emulator SRC V1

Aug 18th, 2016
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <script>
  2. function RollSlott(){
  3. var context = new AudioContext();
  4. var lfo = context.createOscillator();
  5. lfo.frequency.value = 0.5;
  6. var hfo = context.createOscillator();
  7. hfo.frequency.value = 200.0;
  8. var modulationGain = context.createGain();
  9. modulationGain.gain.value = 100.5;
  10. lfo.connect(modulationGain);
  11. modulationGain.connect(hfo.detune);
  12. hfo.connect(context.destination);
  13. hfo.start();
  14. lfo.start();
  15. var Bar=parseFloat(Math.random()*21.9);
  16. var Barr=parseFloat(Math.random()*21.9);
  17. document.body.innerHTML=(Bar+":"+Barr);
  18. var PlayLen=21.1;
  19. if(Bar!=0){
  20. Bar--
  21. }else if(Bar!=21){
  22. Bar++
  23. }
  24. var context = new AudioContext();
  25. oscillator=context.createOscillator();
  26. oscillator.type = 'sine';
  27. oscillator.frequency.value = Bar;
  28. oscillator.connect(context.destination);
  29. oscillator.start(0);
  30. oscillator.stop(PlayLen);
  31. oscillator.disconnect(PlayLen);
  32. lfo.stop(PlayLen);
  33. lfo.disconnect(PlayLen);
  34. hfo.stop(PlayLen);
  35. hfo.disconnect(PlayLen);
  36. }
  37. </script>
  38. <button onclick="script:
  39. var rolls=10;
  40. while(rolls!=0){
  41. rolls--;
  42. var Timer1 = setTimeout ('RollSlott();',0.0001);
  43. var Timer1 = setTimeout ('RollSlott();',0.002)
  44. var Timer1 = setTimeout ('RollSlott();',0.03)
  45. var Timer1 = setTimeout ('RollSlott();',0.04)
  46. var Timer1 = setTimeout ('RollSlott();',0.5)
  47. }">Roll Static Test Now!!</button>
  48. <script>
Advertisement
Add Comment
Please, Sign In to add comment