# Generative Pills #2: The Music of Pi

Pi () is the most famous irrational number; the circumference of a circle is given by its diameter (two times its ray) multiplied by Pi, but ….

Pi is irrational, this means that its decimal representation NEVER ENDS (there is no “last digit of Pi”) and NEVER REPEATS (never enters a permanently repeating pattern); so it’s also an elusive and mysterious number. Already the ancient Egyptians and Babylonians tried to calculate its value as precisely as possible, and currently we “know” the first 68.2 trillions of digits of Pi (record achieved on 14 August 2021 by Team DAViS of the University of Applied Sciences of the Grisons).

Many artists have tried to use Pi as a source of inspiration, but …. but it is conjectured (we have no formal proof of it) digits of Pi are randomly uniformly distributed in the sense that the digits 0 through 9 appear equally often, as do pairs of digits, trios of digits, and so forth. So if you use a subsequence of decimal digits of Pi to (automatically) generate some “art” , then you should obtain the same result if you use a simple random number generator.

NEVERTHELESS ….

# Generative Pills #1: Snakeline Drawings

[This is the first post of a serie dedicated to some ideas of generative art (graphics and music)]

I’ve always been a fan of the videogame Nibbler  and other snake-like videogames (I also “played” with them theoretically … but this is a total different story 😉 ). But can the concept be used for generative art? I had an idea and set up a quick sketch in which many colored snakes freely run around the screen, random food blocks are placed on the screen and whenever a snake eats a food its length increses, when a snake hits another snake or its own tail it tries to change direction … but the result was not so promising; this is an image of the sketch:

Then I tried using a simple line to draw the snake and use another set of rules:

The SNAKELINE DRAWINGS algorithm:

• a set of “snakes” (drawn as lines) are randomly placed on the screen
• each snake:
• has a random color. The color is picked from a finite palette for better results.
• can move horizontally/vertically/diagonally (for mor interesting results, some of them can move only horizontally/vertically)
• has a preferred rotation angle (clockwise or counterclockwise)
• when a snake moves its length increases
• if a snake hits another snake or its own tail, it tries to rotate and
continue its run (or stops moving)

… and “magically” the results became more interesting:

I don’t know if its original: the dynamics is similar to the Tron bikes race  and I also found a method to generate paintings in the style of Piet Mondrian by Michael Fogleman (2011), but the results are quite different. So let me know in the comments if someone else has already used this technique.

I used the Snakeline Drawings algorithm to make some videos (please subscribe to my channel):

A showcase of images produced by the algorithm.

A “fractal” tribute to Bach …

snakeline v1.0 source code

# Memories of an Electric Sheep

A simulation of the brain activity of an electric sheep: it dynamically combines some of the best paintings ever created.

The memory evolves and the combinations are endless and unique. With a little bit of patience, weird artistic “anachronisms” can arise: an old japanese boat sailing in Venice, a sleeping hawaiian in front of Plato and Aristotle, a clock near the animals in a prehistoric cave …

The animation was exhibited at PDC@Coimbra 2021 a Processing Community Day initiative supported by the Processing Foundation with the goal of celebrating art, code and diversity while promoting creative coding and computational thinking as tools for creative students, researchers and professionals. The theme of the exhibition was “Anachronism”.

The soundscape is purely generative (made in VCV Rack).