Advertisement
Guest User

binary rage

a guest
Jul 2nd, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // wavepot.com
  3. // binary rage - justaboutdead
  4. var volume = 1.11;
  5.  
  6. var pitch = 11.1;
  7.  
  8. var chorus;
  9. var voices = 8;
  10. var separation = 16;
  11. var detune = 128;
  12.  
  13. function dsp(t){
  14.   chorus = 0;
  15.   for(i = 0; i < voices; i++){
  16.     chorus += (1 / voices) * $(pitch + (detune * i), t + (i * separation));
  17.   }
  18.   return volume * chorus;
  19. }
  20.    
  21.      
  22. var tau = 2 * Math.PI;
  23.  
  24. function $(n, t){
  25.   return sub(1 * tri(n, t) + 10 * sin(n * .01, t), (1 + sin(1, t)) * (0 + (1 + sin(1, t)) * 10), t);
  26. }
  27.  
  28. function sub(wave, mul, t){
  29.   return Math.sin(wave * mul + tau * t);
  30. }
  31.  
  32. function sin(x, t){
  33.   return Math.sin(tau * t * x);
  34. }
  35.  
  36. function tri(x, t){
  37.   return Math.abs(1 - (2 * t * x) % 2) * 2 - 1;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement