November 7, 2025
Beats, bugs & parser wars
My Experience of building Bytebeat player in Zig
From boredom to bangers: Zig toy sparks parser wars and purity feud
TLDR: A developer built a tiny math-made music player in Zig and shipped a demo, drawing praise for ditching JavaScript “eval.” Comments erupted over parser styles and whether the sound truly depends only on time “t,” with Zig fans touting arena allocators. It’s a snapshot of creative coding fueling spirited debates.
A developer quit the grind and, for pure fun, built a tiny “bytebeat” music toy in Zig — think math-made beats from one variable, time. He loved Zig’s C-like feel and shipped a browser demo, even wrestling with graphics and WebAssembly, no JavaScript “eval” shortcuts. Applause… then drama.
First flare-up: the parser wars. Veteran performer kragen chimed in with, “I used a shunting-yard parser rather than a Pratt parser,” which is basically two rival ways to read math. Instantly, the thread split into Team Yard vs. Team Pratt, swapping nerdy flexes and memes about DJs fighting over calculators.
Then came the purity feud. Commenter diek spotted the same time value (“t”) producing different outputs in the image, hinting at hidden state. Purists asked, “Is this even bytebeat?” Pragmatists shrugged: “If it sounds good, it is good.” That back-and-forth became the night’s main riff.
Meanwhile, Zig fans cheered the arena allocator — a memory trick you reset every frame — with ww520’s praise turning into jokes like “wish I could reset my week that easily.” The vibe: dial‑up‑modem rave meets compiler geekery. Love it or side‑eye it, this passion project sparked beats, debates, and plenty of playful shade.
Key Points
- •The author built a bytebeat player using the Zig programming language and provides a demo and web version.
- •Bytebeat generates PCM audio from short time-based expressions; an example is “t*(42&t>>10).”
- •Bytebeat commonly uses 8-bit, 8 kHz audio, contrasted with standard 16-bit, 44.1 kHz audio; the format traces to early Linux sound-card defaults.
- •The implementation targets both native and web by using Raylib and compiling to WebAssembly via Emscripten.
- •The author explores Zig’s string and memory model, noting strings as []u8 and that strings cannot be used in switch statements.