Origin & Story

About p5.waves

How a list of math expressions became a creative tool - and why switching between wave shapes makes sketches feel alive.

The Dataset

It started with a shared list of wave formulas - short math expressions, each producing a different pattern from a single input number. Sine, cosine, tangent, modulo, absolute value, rounding - combined in dozens of ways.

The original dataset came from the creative coding community. GenerativePunk and ffd8 contributed the core set of formulas that would become the foundation of this library. Each formula was small enough to read in a single line, expressive enough to recognise by its shape.

The Origin Grid

The moment everything clicked was a 16×16 binary grid. Two wave algorithms - one for rows, one for columns - combined into a black-and-white pattern. When the grid went all-black or all-white, it auto-advanced to the next formula pair.

Genuary 2025 · 16×16 challenge · live sketch (original 37 formulas - 3 near-duplicates were removed in v2)
row: 0 · col: 10

That sketch was about 30 lines of draw logic. But watching it run was a revelation: predictable math producing patterns that felt alive. Each formula switch changed the character of the grid - from stripes to checkers to organic clusters to total silence, then back again.

This was the emotional benchmark. Every decision in the library since then has been measured against that feeling: would this make the grid sketch simpler or more expressive?

From Predictable to Surprising

p5.js sketches are deterministic by default. Run the same code, get the same picture. That is a feature for learning, but a limitation for creative expression. The sketch looks identical every time - no variation, no discovery, no surprise.

p5.waves exists to change that. By giving you 35 formulas you can switch between, every run can produce a different result. Not random chaos - structured variation. The wave always has a recognisable shape. But which shape? That can change.

Seeding, morphing, shifting, wild mode - these are all mechanisms for the same idea: the sketch should feel different every time you reload, while staying recognizable. A different result every run, but never a broken one.

Building the Library

The design decisions were driven by simplicity. One function, one number back: Waves.wave(y). No setup required. No configuration before you start. The mental model mirrors noise(y) in p5.js - pass a coordinate, get a value.

Everything else layers on top: naming formulas, morphing between them, caching with samplers, sampling grids. But the entry point is always the same single function call. If user code becomes awkward to use the library, the fix belongs in the library - not in instructions telling the user to write differently.

On AI Collaboration

The starting point was small.

In January 2026 I found a small repo with a beautifully curated set of wave formulas. I later learned they had been curated by none other than Ted Davis.

Inspired by them, I threw myself into the Genuary 16×16 prompt and saw the magic with my own eyes for the first time. The formulas as a simple JSON dataset worked magic, just as they were — my sketch was full of life, instantly.

The path from that simple sketch to this single-file p5.js addon library was built in heavy collaboration with AI assistants, in order of their appearance during the first four months of 2026. Claude stuck around as the ever-improving, professional, and insightful coder and creator.

It felt like the work of a pioneer — directing, adjusting, taming this wild horse of knowledge. As an autistic person who leans toward black-and-white thinking, that role shift never left my mind. I went from coder to project director in no time, and I kind of liked how things went. I directed, weighed, tested, pushed, and curated.

Old commits in the repo still carry AI co-author trailers from earlier tooling. I keep them as an honest record of how the work happened. Going forward, the responsibility is mine — including when something needs to be answered, fixed, or rethought.

Makers & Contributors

Maker:

Sebastien Vanblaere - prjcts.be

Contributors (wave formula dataset):

tw@GenerativePunk - original dataset contributor
gh@ffd8 (Ted Davis) - original dataset contributor, Oscillation Sandbox

Reference for rectangular/pulse formulas:
titanwolf.org - pulse/rectangular wave formulas

Reference for triangle formula:
p5.js editor - jeremydouglass triangle sketch