From 6a83c9b84f49d541f39726712b8a0331590555d2 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 12 Mar 2018 01:42:41 +0100 Subject: basic linear spectral manipulation! --- client/lib/util.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'client/lib/util.js') diff --git a/client/lib/util.js b/client/lib/util.js index fd48768..1bbee9d 100644 --- a/client/lib/util.js +++ b/client/lib/util.js @@ -21,6 +21,7 @@ function lerp(n,a,b){ return (b-a)*n+a } function angle(x0,y0,x1,y1){ return Math.atan2(y1-y0,x1-x0) } function dist(x0,y0,x1,y1){ return Math.sqrt(Math.pow(x1-x0,2)+Math.pow(y1-y0,2)) } function xor(a,b){ a=!!a; b=!!b; return (a||b) && !(a&&b) } +function quantize(a,b){ return Math.floor(a/b)*b } function shuffle(a){ for (var i = a.length; i > 0; i--){ var r = randint(i) @@ -104,7 +105,7 @@ function requestAudioContext (fn) { } export { - clamp, choice, mod, lerp, angle, dist, xor, + clamp, choice, mod, lerp, angle, dist, xor, quantize, randint, randrange, randsign, shuffle, gaussian, browser, requestAudioContext, } -- cgit v1.2.3-70-g09d2