Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // wavepot.com
- // android laughter - justaboutdead
- var volume = 1;
- var tau = 2 * Math.PI;
- var pitch = 1;
- var chorus;
- var voices = 8;
- var separation = 3/tau;
- var detune = 1;
- function dsp(t){
- chorus = 0;
- for(i = 0; i < voices; i++){
- chorus += sub( (1 / voices) * $(pitch + (detune * i), t + (i * separation)), 30, t) / voices;
- }
- return volume * chorus;
- }
- function $(n, t){
- return sub(1 * tri(n, t) + 10 * sin(n * .01, t), (1 + sin(1, t)) * (0 + (1 + sin(0.1, t)) * 10), t);
- }
- function sub(wave, mul, t){
- return Math.sin(wave * mul + tau * t);
- }
- function sin(x, t){
- return Math.sin(tau * t * x);
- }
- function tri(x, t){
- return Math.abs(1 - (2 * t * x) % 2) * 2 - 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement