Nodes: Beat tiles

glint · Examples · Tutorials · Gallery

Visual node mode: a grid of circles, each cell its own colour from noise, all swelling with the bass.

Audio-reactive: it moves with music from a microphone, line-in or a file.

Nodes: Beat tiles: an audio-reactive GLSL shader

An example in glint, a free live shader editor in the browser: the GLSL code floats over the running picture and recompiles as you type.

The code

One pass, in GLSL.

fragment shader (generated from a node graph)

#version 300 es
precision highp float;

// Generated from nodes: edit the graph, or use "Convert to code" to take it from here by hand.
uniform vec2 resolution;
uniform float time;
uniform vec3 spectrum;
uniform float beat;
uniform vec3 spectrumIntegrated;

in vec2 v_texcoord;
out vec4 fragColor;

float n_hash(vec2 p) { p = fract(p * vec2(123.34, 456.21)); p += dot(p, p + 45.32); return fract(p.x * p.y); }
vec2 n_hash2(vec2 p) { return fract(sin(vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)))) * 43758.5453); }
float n_noise(vec2 p) {
  vec2 i = floor(p), f = fract(p), u = f * f * (3.0 - 2.0 * f);
  return mix(mix(n_hash(i), n_hash(i + vec2(1, 0)), u.x), mix(n_hash(i + vec2(0, 1)), n_hash(i + vec2(1, 1)), u.x), u.y);
}
vec3 n_palette(float t, vec3 a, vec3 b, vec3 c, vec3 d) { return a + b * cos(6.2831853 * (c * t + d)); }

void main() {
  // UV
  vec2 nn5dnb7r0hl_uv = (v_texcoord * 2.0 - 1.0) * vec2(resolution.x / resolution.y, 1.0);
  vec2 nn5dnb7r0hl_st = v_texcoord;
  // Tile
  vec2 nn5dnb7seu3_uv = (fract(nn5dnb7r0hl_uv * 8.0 * 0.5) - 0.5) * 2.0;
  vec2 nn5dnb7seu3_cell = floor(nn5dnb7r0hl_uv * 8.0 * 0.5);
  // Time
  float nn5dnb7xgyy_t = time * 0.3;
  // Noise
  float nn5dnb7yhms_out = n_noise(nn5dnb7seu3_cell * 0.9 + vec2(nn5dnb7xgyy_t, nn5dnb7xgyy_t * 0.7));
  // Palette
  vec3 nn5dnb7zok3_rgb = n_palette(nn5dnb7yhms_out, vec3(0.5), vec3(0.5), vec3(2.0, 1.0, 0.0), vec3(0.5, 0.2, 0.25));
  // Audio
  float nn5dnb7toho_bass = spectrum.x;
  float nn5dnb7toho_mid = spectrum.y;
  float nn5dnb7toho_treble = spectrum.z;
  float nn5dnb7toho_beat = beat;
  float nn5dnb7toho_flow = spectrumIntegrated.x;
  // Multiply
  float nn5dnb7vgge_out = (nn5dnb7toho_bass * 0.6);
  // Add
  float nn5dnb7uny6_out = (nn5dnb7vgge_out + 0.35);
  // Circle
  float nn5dnb7wakk_mask = (1.0 - smoothstep(nn5dnb7uny6_out - 0.06, nn5dnb7uny6_out + 0.06, length(nn5dnb7seu3_uv)));
  float nn5dnb7wakk_dist = (length(nn5dnb7seu3_uv) - nn5dnb7uny6_out);
  // Multiply
  vec3 nn5dnb80240_out = (nn5dnb7zok3_rgb * vec3(nn5dnb7wakk_mask));
  fragColor = vec4(nn5dnb80240_out, 1.0);
}

More Nodes & glitch examples

Nodes: Neon rings · Nodes: Kaleidoscope · Nodes: Liquid cells · Nodes: Paint trails · Nodes: Twirl · Nodes: Polar rings · Nodes: Ink clouds · Nodes: Kaleido checker