Audio Fractal
Generate real-time audio from fractal mathematics. Explore Mandelbrot, Julia, Sierpinski fractals sonified through additive synthesis.
About
Fractals encode infinite complexity in finite rules. This tool computes escape-time fractals (Mandelbrot, Julia sets) and geometric fractals (Sierpinski, Koch) then maps their mathematical structure to audible frequencies via additive synthesis. The iteration count n at each sampled point determines pitch on a logarithmic scale between 20 Hz and 8000 Hz. Escape velocity modulates amplitude envelopes. Fractal density across a scan line controls harmonic content through up to 8 partials. The result is not random noise. It is a deterministic acoustic signature of the fractal geometry.
Misunderstanding the mapping between iteration depth and frequency produces harsh, unmusical output. This tool applies logarithmic frequency scaling consistent with human pitch perception (Weber-Fechner law). It also normalizes amplitude across regions of varying density to prevent clipping. Note: results approximate the fractalβs structure at the chosen resolution. Increasing maxIter reveals finer detail but increases computation time proportionally. Audio output depends on your systemβs sample rate, typically 44100 Hz or 48000 Hz.
Formulas
The core escape-time algorithm iterates the recurrence relation:
where z0 = 0 for Mandelbrot and z0 = pixel coordinate for Julia sets. Iteration stops when |z| > 2 (escape radius) or n reaches maxIter. The escape count n is then mapped to audio frequency:
This logarithmic mapping ensures perceptually uniform pitch distribution. The amplitude for each sampled point uses normalized iteration ratio:
Points inside the set (n = maxIter) produce silence. Harmonic content uses additive synthesis with k partials at integer multiples of the fundamental:
where f = fundamental frequency in Hz, t = time in s, A = amplitude, K = number of harmonics (derived from local fractal density), k = harmonic index, fmin = 20 Hz, fmax = 8000 Hz, maxIter = maximum iteration depth.
Reference Data
| Fractal Type | Formula | Dimension | Audio Character | Iteration Range | Typical Frequency Spread |
|---|---|---|---|---|---|
| Mandelbrot Set | zn+1 = zn2 + c | 2.0 (boundary) | Rich, evolving tones with harmonic clusters at set boundary | 50 - 500 | 80 - 6000 Hz |
| Julia Set (c = β0.7 + 0.27i) | zn+1 = zn2 + c | 1.2 - 2.0 | Symmetrical, bell-like timbres with mirrored spectral content | 50 - 300 | 100 - 5000 Hz |
| Burning Ship | zn+1 = (|Re(z)| + i|Im(z)|)2 + c | 2.0 | Harsher, asymmetric textures with abrupt transitions | 50 - 400 | 60 - 7000 Hz |
| Sierpinski Triangle | Chaos game: 3 vertices | 1.585 | Tritone intervals, sparse rhythmic pulses | 1000 - 50000 points | 200 - 3000 Hz |
| Koch Snowflake | L-system: F β F+FββF+F | 1.2619 | Self-similar melodic patterns at multiple octaves | 1 - 7 depth | 100 - 4000 Hz |
| Cantor Set | Remove middle third recursively | 0.6309 | Sparse, gapped frequency bands with silence intervals | 1 - 12 depth | 50 - 2000 Hz |
| Mandelbrot (Power 3) | zn+1 = zn3 + c | 2.0 | More symmetric harmonics, organ-like sustained tones | 50 - 300 | 100 - 5500 Hz |
| Multibrot (Power 4) | zn+1 = zn4 + c | 2.0 | Four-fold symmetric, crystalline overtone series | 30 - 200 | 120 - 4500 Hz |
| Tricorn (Mandelbar) | zn+1 = n2 + c | 2.0 | Conjugate symmetry produces detuned, beating frequencies | 50 - 300 | 80 - 5000 Hz |
| Newton Fractal (zΒ³β1) | Newtonβs method root finding | Basin boundaries | Rapid convergence β short attack; slow convergence β ambient pads | 20 - 100 | 150 - 3500 Hz |
| Logistic Map | xn+1 = r β xn(1 β xn) | N/A (1D) | Bifurcation cascades create rhythm from order to chaos | 100 - 1000 | 40 - 2000 Hz |