## Anis Haron’s Project

Posts: 19
Joined: Tue Jan 17, 2012 4:10 pm

### Anis Haron’s Project

Anis Haron’s Project

anisbharon
Posts: 10
Joined: Tue Jan 17, 2012 4:41 pm

### Re: Anis Haron’s Project

Probability music: An exploration of probability in generative music

Probabilistic approach to art generation has been explored by art practitioners since the early twentieth century. Some notable early explorers of chance-based art are:
Lewis Carroll (Curiosa Mathematica, Part II: Pillow Problems),
http://mathlair.allfunandgames.ca/pillow.php
Marcel Duchamp (Erratum Musical, composition based on chance operations for three voices),
http://www.artesonoro.net/artesonoroglo ... champ.html
Tristan Tzara (chance operations as a method of generating poetry),
http://www.poets.org/poetsorg/text/poet ... operations
Ellsworth Kelly (Spectrum Colors Arranged by Chance I to VIII),
http://socks-studio.com/2014/03/05/the- ... i-to-viii/
François Morellet (Répartitions aléatoires, random distributions of black and white squares according to odd and even numbers of Pi)
http://slash-paris.com/en/artistes/fran ... t/a-propos
and John Cage (Music of Changes, Imaginary Landscape No. 4), among others.
http://en.wikipedia.org/wiki/Music_of_Changes

A probabilistic approach can be summarized as follows:
1. a space of possibilities is defined in explicit, mathematical terms
2. a probability distribution is defined over this space
3. an algorithm is executed which draws random samples from the space, in accordance with the probability distribution.

For my project, i will be experimenting with a dynamic tonal mapping strategy within a probabilistically defined space, driven by a physics simulator engine.

The bean machine (also known as the Quincunx or Galton box) is a device invented by Sir Francis Galton, an english victorian polymath to demonstrate the central limit theorem. The machine consists of a vertical board with interleaving rows of pins. A ball would be dropped from the top for it to traverse through the board, hitting a pin at every row on its way down, bouncing either to the left or right on each succession of rows.

Image01: Bean machine, as drawn by Sir Francis Galton

Each pin in a bean machine would have 8 neighboring pins (top, bottom, left, right, upper left, lower left, upper right, lower right), except for the pins at the edges of the interleaved grid. Since the pins in a bean machine are interleaved, a pin located at row ’x’ would have a top neighboring pin at row ’x+2’, bottom neighboring pin at row ‘x-2’, upper left and upper right neighboring pins at row ‘x+1’, lower left and lower right neighboring pins at row ’x-1’, and both left and right neighboring pins at row ’x’.
Image02: 8 neighboring pins

The harmonic table note layout is a symmetrical tonal array in a hexagonal grid, well known since at least the 18th century. This particular layout allows a large number of isomorphic note assignments, in which any given sequence or combination of musical intervals will have the same shape wherever it occurs. Since the layout is in a hexagonal grid, each cell have 6 adjacent neighbors. For each cell’s adjacent neighbors, it’s top neighbor will a perfect 5th apart, top right neighbor a major 3rd apart and it’s top left neighbor a minor 3rd apart. This mapping procedure leads to a half-step (semitone) interval distance at every other column. For example, a cell at {row x, column y} would have a cell a half-step higher at {row x, column y+2}, and a cell a half-step lower at {row x, column y-2}.
Image03: 8 neighboring cells

With 8 neighbors, a direct mapping of cells from the harmonic table note layout to the interleaved pins of a bean machine would be possible.
Imgae04: Mapping harmonic table cells to pins

In an unbiased bean machine, the probability of a dropped ball bouncing to the left or right after hitting a pin are equally likely (50/50 chance). After a number of successive drops, the number of balls to exit the bean machine would form a bell curve, with the most probable exit point around the center and least probable exit point at the extreme right and left. A larger sample would yield a more distinct bell curve. As an example, the probability of getting any number from 1 to 6 in a roll of one unbiased 6 faced dice (cube) is 1/6, which means it is equally likely to get any of the six numbers. Increasing the number of dice rolled, for example to 2 dice rolled simultaneously, makes the lowest rollable number a 2, while the highest possible number a 12. Furthermore, there is only one possible combination of rolling a 2 (both dice rolled a 1) or 12 (both dice rolled a 6). However, in a 2 dice roll, there are 6 ways we could roll a 7 (6+1, 5+2, 4+3, 3+4, 2+5, 1+6), increasing the likelihood of rolling a 7 with a 2 dice roll. It is worth noting that 7 is the midrange, which is the mean of the lowest and highest possible values. (7 = (2+12) / 2)

http://4.bp.blogspot.com/_LnLmR0nJdMs/S ... O+Dice.png
Image05: Sum of 2 dice roll

As we increase the number of dice used per roll (increasing number of samples), the corresponding bell curve gets more distinct, with the most probable rolled value in the midrange, while the least probable values to the extreme left and right.

Image06: Central Limit Theorem

For the bean machine, the probability that a ball would exit through the ‘k-th’ slot can be described with the following mathematical equation.
Image07: Equation

n and k in parentheses is the binomial coefficient, pronounced as ’n choose k’. The binomial coefficient describes the number of possible paths for a ball to reach the ‘k-th’ slot counting from the left, akin to the number of possible ways to roll a 7 with a 2 dice throw. In this instance, ’n’ corresponds to the number of rows available in the machine, while ‘k’ corresponds to the number of right bounces made by a ball on its way down all ’n’ rows. The formula p^k(1-p)^(n-k) can be broken to 2 parts. As ‘k’ corresponds to the number of right bounces, p^k describes the probability of a dropped ball bouncing to the right, while (1-p)^(n-k) describes the probability of the same ball bouncing to the left. In an unbiased bean machine, in which the probability of a ball going to either the left or right are equally likely, P is 0.5 (equates to 50% chance).

We can use Pascal’s triangle to help us to visualize the binomial coefficient for each pin in a bean machine. Pascal’s triangle is a mathematically defined triangular array, named after the French mathematician Blaise Pascal. To construct a Pascal’s triangle, start with a single element (an element is a pin for the bean machine) in the first row, numbered 1. The next row will have an extra element, and each element is a sum of its top left and top right neighbors (empty elements are substituted with a 0). The number for each element is the binomial coefficient for said location, which is the total number of possible routes a ball could take to reach a given pin in a bean machine.

Image08: 6 rows of Pascal's triangle

anisbharon
Posts: 10
Joined: Tue Jan 17, 2012 4:41 pm

### Re: Anis Haron’s Project

As a project deliverable, i will write a program to simulate a bean machine, mapped to the harmonic table note layout. My program will be written using openFrameworks C++ toolkit. A question i had when coming up with this idea is to explore possible sound output when the rules of physics are distorted, leading to a biased bean machine without a gaussian distribution. In an unbiased machine, the only possible directions after a bean hits a pin are either to the left or right. This means a steady (and possibly boring) increment of major 3rds with right bounces and minor 3rds with every left bounces. A distorted physics could yield unpredictable (possibly less boring) results.

For physics simulation, i will be using Box2D, an open source 2 dimensional physics engine. http://en.wikipedia.org/wiki/Box2D The same physics engine was used for Angry Birds.

To achieve dynamic physical distortion, certain parameters are left up to the user's discretion via a GUI. User defined parameters are:
1.World's gravity.
Default value is set at 10. Increasing gravity pulls the beans downwards faster, while decreasing it slows it dramatically. Very low gravity gives a more spaced out feel, as the time from one hit to another will be slower. Although the general direction of beans will still be downwards with low gravity, the beans are 'lighter' and its trajectory are less prone to only left and right. Hence, more variety in sound output.

2.Bean's frequency, size, density, bounce and friction.
Bean's frequency handles the amount of beans dropped per second. While size sets the diameter of the beans. Its density, bounce and friction sets the tone for how the beans would behave in the array of pegs. Density sets a bean's mass per unit volume, bounce sets the bean's reaction after a hit (absorbing or dispersing), while friction sets the rotational movement of a bean (slide or roll). By tweaking these parameters, a chaotic bounce behavior (akin to pinball machines) could be achieved.

3.Peg's size and distribution pattern.
Peg's size contributes to the amount of time taken for the next hit to occur after a hit. A smaller peg size leaves plenty of empty space. When combined with the right bean size, the time between event triggers could be tweaked using this parameter. There're 3 choices for distribution pattern of pegs, uniform, increment and decrement. In uniform setting, all pegs shares the same size. While in increment setting, peg size increases top to bottom, and decreases top to bottom with decrement setting. Increment and decrement both adds some variety to time between event triggers.

4.Guard's size.
A guard is used to direct bean bounces after the initial hit of the first peg. Certain parameters would force the beans out of the array of pegs (eg. high bounce value). This could be rectify by specifying the right guard size.

5.Seed note.
The initial pitch class used for tone mapping.