Cellular Automata Music
Elementary cellular automata generate surprisingly musical patterns. Each column maps to a note in a musical scale. When a cell is alive, its note plays. Rule 30 on the pentatonic scale is a good place to start.
How it works
A 1D elementary cellular automaton evolves row by row: each cell’s next state depends on its current state and its two neighbors, according to a rule number (0–255). The rule number encodes eight output bits for all eight possible 3-cell neighborhoods.
The grid is drawn with time flowing downward. Each column is mapped to a note in the chosen musical scale. When a cell in the current row is “alive” (filled), its corresponding note plays through the Web Audio API.
Interesting rules to try
Rule 30 produces pseudo-random chaos. Rule 110 is Turing complete and produces complex, structured patterns. Rule 90 makes a Sierpinski triangle. Rule 184 models traffic flow. Each generates a different musical character.
Scales
The pentatonic scale (five notes per octave) avoids dissonance almost entirely — nearly any combination of notes sounds pleasant. The blues scale adds a flat fifth. Major and minor have seven notes, and chromatic uses all twelve semitones.