Magic Squares

Sitting in on some undergraduate composition lectured this year, using it as a chance to brush up on some things I was never formally taught. This is particularly beneficial to my knowledge of acoustic contemporary composition (as opposed to the electroacoustic side of things). Yesturday I sat in on a lecture on Maxwell Davies’ use of Magic Square number patterns in Ave Maris Stella (1975; chamber ensemble). I wrote a little python script to generate any odd-order sized square (n), and a the values with modulo wrap (where modulo = n):

# solves magic square for odd-ordered grid sizes
# owmtxy 17/10/2012
# for python v.2.6.6

n = int(input("Enter (odd) order size (n): "))
square = []
def calculateSquare(row,col):
val = n*((row+col-1+(n/2))%n) + ((row + (2*col)-2)%n)+1;
return val

#Create Array
print "Magic",n,"*",n,"Square Array:"
for i in range(n):
for j in range(n):

# Print array in a nice n*n grid
for k in range(n):
print square[k*n:(k*n)+n]

print "n Modulo",n,"Array:

#Create Array of modulo values
modSquare = []

for i in range(n):
for j in range(n):
modulo = (calculateSquare(i+1,j+1)%n)

# Print array in a nice n*n grid
for k in range(n):
print modSquare[k*n:(k*n)+n]

To model Maxwell Davies’ use somewhat, a regular n x n grid is drawn up, and a melody of length n is written to the top row of the grid. Each row is then transposed (using the interval of that top-line melody), the pitch of cell i comes from cell i-(n-1). In a 7×7 grid, the starting pitch of the second row (cell 8), comes from cell 2. Our magic square layout is then used to re-map these cells into a new order, giving us a magic square of pitch classes.

My plan is to use this grid in conjunction with some form of cellular automata to select or ‘activate’ cells of the magic square.

Tendency Masks & Vector-Based Amplitude Panning [Max/MSP]

Been thinking a bit about Koenig’s ‘Tendency Masks’ since reading more about them in Robert Rowe’s Machine Musicianship the other day. As a distribution method, they seem perhaps too random and arbitrary for generating or controlling pitch parameters (unless we’re talking grain pitch, or other techniques that benefit a more sporadic distribution?) To me, part of the interest in tendency masks lays in their gestural nature, and the possibility to relate this to other gestural behaviours. The patch here is a simple realisation of a tendency mask in Max, controlling some basic MIDI notes and [cycle], hooked up to Ville Pulke‘s vector-based amplitude panning object, [vbap] (just a 2D version at the moment, elevation not hooked up).

This demo is setup as a quadrophonic array using the [vbap]. In this setting, a narrower mask limits our signal to a single speaker location, whilst opening the mask up allows signal to move throughout the array more. Control of the system thereby comes from gesturally navigating narrower bands between speakers, and opening masks up to make full use of the array.

A nice little addition to the tendency mask outlined in Rowe (p.208) is the ability to control density as a separate breakpoint function, thereby changing over time (rather than even throughout). At the moment, my implementation of this is a little shaky at best (controlling the frequency of a [qmetro] object), but the result is there and gives a nice effect. Next steps with this include hooking up the [vbap]’s ‘elevation’ argument, cleaning up the mask density control, and linking it to loudspeaker spreading parameters.

Thanks to Chris Dobrain at the cycling74 forums for his advice on implementing the masks with [function].