Nodes: Beat circle

glint · Examples · Tutorials · Gallery

Visual node mode: a neon ring that shrinks through each beat (Tempo's beatPhase, through One minus) and glows in a colour that drifts with time.

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

Nodes: Beat circle: 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 float time;
uniform vec2 resolution;
uniform float beatPhase;
uniform float barPhase;
uniform int beatIndex;

in vec2 v_texcoord;
out vec4 fragColor;

vec3 n_palette(float t, vec3 a, vec3 b, vec3 c, vec3 d) { return a + b * cos(6.2831853 * (c * t + d)); }

void main() {
  // Time
  float nn5dnjaz7m2_t = time * 0.1;
  // Palette
  vec3 nn5dnjb0hxd_rgb = n_palette(nn5dnjaz7m2_t, vec3(0.5), vec3(0.5), vec3(2.0, 1.0, 0.0), vec3(0.5, 0.2, 0.25));
  // UV
  vec2 nn5dnjas9qx_uv = (v_texcoord * 2.0 - 1.0) * vec2(resolution.x / resolution.y, 1.0);
  vec2 nn5dnjas9qx_st = v_texcoord;
  // Tempo
  float nn5dnjatvmn_beatPhase = beatPhase;
  float nn5dnjatvmn_barPhase = barPhase;
  float nn5dnjatvmn_beats = (float(beatIndex) + beatPhase);
  // One minus
  float nn5dnjauslt_out = (1.0 - nn5dnjatvmn_beatPhase);
  // Multiply
  float nn5dnjav2qo_out = (nn5dnjauslt_out * 0.35);
  // Add
  float nn5dnjawy8s_out = (nn5dnjav2qo_out + 0.15);
  // Circle
  float nn5dnjaxg89_mask = (1.0 - smoothstep(nn5dnjawy8s_out - 0.01, nn5dnjawy8s_out + 0.01, length(nn5dnjas9qx_uv)));
  float nn5dnjaxg89_dist = (length(nn5dnjas9qx_uv) - nn5dnjawy8s_out);
  // Glow
  float nn5dnjaykb1_out = (0.02 / max(abs(nn5dnjaxg89_dist), 0.0005));
  // Multiply
  vec3 nn5dnjb158e_out = (nn5dnjb0hxd_rgb * vec3(nn5dnjaykb1_out));
  fragColor = vec4(nn5dnjb158e_out, 1.0);
}

More Nodes & glitch examples

Nodes: Sunset stripes · Nodes: Spotlight · Nodes: Colour wheel rings · Nodes: Marble · Nodes: Zoom trails · Nodes: Bass twirl · Nodes: Colour drift · Nodes: Crystal