Open source math · MIT

The 34 Waves

Every wave in this library is a short math expression. No magic, no black boxes. Stacking sines, cosines, tangents, absolute values, and modulo operations — that is all it takes to give a number a personality. Here is every formula, laid open.

Building Blocks

Six mathematical operations. Combined in different ways, they produce 34 distinct wave characters. Each operation adds a specific quality — a mood, a rhythm, a texture.

sin(x) Sine — the smooth oscillator

The foundation. Smooth, continuous, periodic. Every wave that flows uses sine somewhere. It is the default mood: calm, predictable, organic.

cos(x) Cosine — the phase partner

Same shape as sine, shifted by a quarter cycle. When multiplied with sine, it creates interference patterns — wobble, beating, complexity from simplicity.

tan(x) Tangent — the wild card

Smooth until it isn't. Tangent spikes to infinity at regular intervals, creating sudden bursts and unpredictable energy. The source of controlled chaos.

abs(x) Absolute — the mirror

Folds negative values up. Applied to sine, it creates sharp peaks — mountain ridges where valleys used to be. Reflections and inversions.

x % n Modulo — the fragmenter

Remainder after division. Wraps values into repeating ranges, creating sawtooth sweeps, zig-zag textures, and fragmented patterns from smooth inputs.

ceil(x) round(x) Stepping — the quantizer

Snaps continuous values to integers. Smooth curves become staircase patterns — a digital feel, hard edges, binary decisions from analog input.

The Families

The 34 formulas group into families by character. Each family shares a mood — a way of moving, a texture, a temperament. Within each family, individual formulas add their own twist.

Pure Sine

The smooth foundation

Pure sine waves at different frequencies and amplitudes. Calm, flowing, organic. The simplest formulas — and often the most musical. This is the baseline mood: everything else is a departure from here.

Layered Sine

Interference and complexity

Two or more trigonometric functions multiplied or added together. When sine meets cosine at different frequencies, they create beating patterns, wobble, and organic complexity. The mood shifts from calm to restless — still smooth, but with internal tension.

Amplitude Modulated

Shape-shifting over position

Sine multiplied by a ramp or modulo expression. The wave's intensity changes across the input range — it breathes, swells, fades. These formulas have a sense of direction and narrative that static oscillators lack.

Peak & Valley

Reflections and inversions

Absolute value folds the wave. Negative halves become positive, creating sharp peaks and hard transitions. The mood is angular, geological — ridges and canyons carved from smooth oscillation.

Stepped & Quantized

Digital from analog

ceil(), round(), and floor() snap smooth curves into staircases. The mood is mechanical, decisive — a smooth world forced into binary choices. Combined with tangent, the steps become unpredictable and dramatic.

Sawtooth & Ramp

Linear sweep

Modulo drives a linear climb that resets at regular intervals — the sawtooth. These waves have directional energy, a sense of effort and release. Triangle is the bidirectional version: up and down, symmetric and restless.

Square & Pulse

Binary rhythm

On or off, high or low. These formulas use conditional logic or modulo thresholds to create hard-switching patterns. The mood is rhythmic, percussive, digital.

Modulo Patterns

Texture from remainder

Sine or position put through modulo creates fragmented, aliased textures. The original wave is still there, but chopped and wrapped — producing unexpected rhythms and visual noise from clean mathematical operations.

Chaos & Noise

Controlled unpredictability

Tangent spikes, Perlin noise, and random values. These formulas embrace unpredictability as a feature. The mood ranges from jittery to organic randomness — all useful precisely because they break the pattern.

Special

Unique character

Formulas that don't fit neatly into a family — logarithmic decay, squared sine, conditional switching. Each has a personality all its own.