Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

clown dentistry

View clown.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
var baudio = require('baudio');
var tau = Math.PI * 2;
var b = baudio(function (t) {
var g = [
1, 0, 5/4, 0, 1, 3/5, 0, 0,
][Math.floor(t * 2 % 8)];
var grunge = (g > 0) * Math.pow(2, -2) * Math.pow(2, g);
var yoshi = t % 16 < 8
? Math.floor(t * 40) % 3200
: 2000 / Math.floor(t * 40) % 3200
;
return (
(
0.2 * square(100 * grunge * yoshi)
+ 0.2 * sin(124 * grunge * 20 + Math.floor(t) % 16 * 20)
+ 0.2 * sawtooth(612 * grunge - 1)
+ 0.2 * sawtooth(404 * grunge - 1)
) * (
(square(400) + square(404))
/ 15 + sin(400) * 0.5 + sin(4) + sin(3)
) / 4
+ (t % 8 > 7) * (square(280) + square(285)) * (sin(4) + sin(5)) / 20
+ (t % 8 > 6 && t % 8 < 7) * (
sin(3) * (sawtooth(150) + square(151) + sin(152)) / 8
)
+ (t % 32 > 24) * (
sawtooth(grunge * 6400 + Math.floor(t * 1000 % 4000))
+ square(grunge * 5000 + 4000 / Math.floor(t * 1000 % 4000))
) / 8
);
function sin (x) {
return Math.sin(tau * t * x);
}
function square (x) {
var n = Math.sin(tau * t * x);
return n > 0 ? 1 : -1;
}
function sawtooth (x) {
return t % (1 / x) * x * 2 - 1;
}
});
b.play();
ducin commented

omg, what's that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.