Skip to content

Instantly share code, notes, and snippets.

@fand
Last active August 7, 2018 07:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fand/ce01da0a764ac23b05f1552daf1a4701 to your computer and use it in GitHub Desktop.
Save fand/ce01da0a764ac23b05f1552daf1a4701 to your computer and use it in GitHub Desktop.
/*{ "osc": 4000 }*/
precision mediump float;
uniform float time;
uniform vec2 resolution;
uniform sampler2D backbuffer;
uniform sampler2D osc_tidal;
vec2 rotate(in vec2 p, in float t) {
return mat2(cos(t), -sin(t), sin(t), cos(t)) * p;
}
float random(in vec2 st) {
return fract(abs(sin(dot(st, vec2(94.2984, 488.923))) * 234.9892));
}
float rects(in vec2 p, in float t) {
return random(vec2(p.x * .0001 + t * .008, floor(p.y * 17.)));
}
void main() {
vec2 uv = gl_FragCoord.xy / resolution;
vec2 p = (gl_FragCoord.xy * 2. - resolution) / min(resolution.x, resolution.y);
p *= 3.4;
p = rotate(p, time * .2);
float l = length(p);
float r = texture2D(osc_tidal, vec2(.0)).r * sin(l * 2. + 0.);
float g = texture2D(osc_tidal, vec2(.4)).r * sin(l * 2. + 2.);
float b = texture2D(osc_tidal, vec2(.7)).r * sin(l * 2. + 4.);
float n = rects(p, time);
gl_FragColor = vec4(r, g, b, 1) * n;
gl_FragColor += texture2D(backbuffer, rotate(uv - .5, time) * .9 +.5, time) * .93;
// gl_FragColor = vec4(0);
}
SuperDirt.start()
b = NetAddr.new("127.0.0.1", 4000);
OSCdef(\test, { |msg, time|
var bass2 = false;
var bd = false;
var sd = false;
for(1, msg.size, {
arg i;
bass2 = if(msg[i] == 'bass2', true, bass2);
bd = if(msg[i] == 'bd', true, bd);
sd = if(msg[i] == 'sd', true, sd);
});
b.sendMsg("/tidal", bass2, bd, sd);
}, '/play2', n);
cps 0.3
d1 $ s "[bass2 bass2 ~ ~] sd [bd ~ ~ bd] [~ ~ bass2 ~] [~ bass2 ~ ~] sd [bd ~ ~ bd] [~ ~ sd ~] " # crush 4
cps 0.5
d1 $ s "bass2 sd bd sd"
hush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment