Building a glitch shader for the stream music player
- https://www.youtube.com/watch?v=Mwp-uGCUZE4
- Original title: Glitch Shader Effect
A 2h13m live recreational-programming session. Tsoding works on his custom "starting soon" timer / music-player app (written in Jai, using raylib), and adds a GLSL glitch effect to gracefully handle the case where a song file is invalid or fails to load — instead of skipping it, the screen shows a glitchy distortion.
The app reads an `.ini` playlist describing each song's file path, link (rendered as a QR code), artist, title and thumbnail. The motivating problem: what should happen when a file is invalid? Rather than silently skipping, he decides to render a glitch effect over that entry.
Notable threads through the session:
- He rebuilt raylib 5.5 with FLAC support (which he himself partially contributed upstream — 24-bit sample support), since null's tracks are FLAC; sticks with 5.5 because nothing in 6.0 is worth upgrading for.
- Implements the effect as a fragment shader over a render texture, normalizing texture coordinates by passing a `resolution` uniform set from the main code (and factoring out shader reloading).
- Builds the glitch as horizontal stripes that offset the sampling, then per-channel chromatic-aberration-style offsets ("make it gay" = hue shift) for a real-hacker chiptune aesthetic, driving the distortion with `time` and a hash function whose properties he dislikes.
- Spends the back half tuning parameters (speed, amplitude, offset magnitudes like 6e-5/7e-5) to look convincingly glitchy while keeping the text and QR code readable, finishing the final aesthetic polish offline.