Advertisement
Guest User

satan's bagpipes

a guest
Jul 2nd, 2014
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    
  2.     // wavepot.com
  3.     // satan's bagpipes - justaboutdead
  4.     var volume = 0.666;
  5.      
  6.     var pitch = 0.666;
  7.      
  8.     var chorus;
  9.     var voices = 6;
  10.     var separation = 0.00666;
  11.     var detune = 666.666;
  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(0.666 * tri(n, t) + 0.0666 * sin(n * 666, t), (1 + sin(666, t)) * (2 + (1 + sin(666, t)) * 1), 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