Category Archives: SuperCollider

Adelaide Festival.

(DURHAM) I submitted a soundtrack piece from a couple of years ago, The Method, to the 2014 Adelaide Festival for inclusion in their fantastic “Sound Introversion” web radio stream. If you couldn’t make it down under for the festival, why not check out the global mix of new ambient, drone, minimal, and low-volume electronica here.

In other news, I’ve built a little calculator in SuperCollider which figures out the notated beat divisions required for 2-limb polyrhythms. You can simply substitute your own integers for limb1 and limb2, and SC will output the various possible formats with the total duration units per format.

// polyrhythm calculator based on a formula from Andrew Mead:

var limb1 = 21;      // add your own integers for limb1 and limb2
var limb2 = 25;

var limb1factors = limb1.factors;
var limb2factors = limb2.factors;
var formatDurations;

if(limb1factors.size == 1, { limb1factors.add(1) });
if(limb2factors.size == 1, { limb2factors.add(1) });

if(limb1factors.size > 2, { t = limb1factors[0]*limb1factors[1];
	limb1factors.removeAt(0); limb1factors.removeAt(0); limb1factors.add(t);

if(limb2factors.size > 2, { u = limb2factors[0]*limb2factors[1];
	limb2factors.removeAt(0); limb2factors.removeAt(0); limb2factors.add(u);

a = limb1factors[0];
b = limb1factors[1];

x = limb2factors[0];
y = limb2factors[1];

formatDurations = [[y/b, a/x], [x/b, a/y], [x/a, b/y], [y/a, b/x]];

("Format A –  "+limb1+":"+y+"/"+b+"  "+limb2+":"+a+"/"+x+"  Number of duration units: "+((y/b)*limb1)).postln;
("Format B –  "+limb1+":"+x+"/"+b+"  "+limb2+":"+a+"/"+y+"  Number of duration units: "+((x/b)*limb1)).postln;
("Format C –  "+limb1+":"+x+"/"+a+"  "+limb2+":"+b+"/"+y+"  Number of duration units: "+((x/a)*limb1)).postln;
("Format D –  "+limb1+":"+y+"/"+a+"  "+limb2+":"+b+"/"+x+"  Number of duration units: "+((y/a)*limb1)).postln;
formatDurations.round(0.001).postln;   // change the amount of rounding for more/less precision

This allows you to quickly check if certain integer combinations might work well in terms of the required beat divisions for each limb, although at the moment the code only works for integers with 3 or fewer prime factors.

I’ll wrap up today’s post with another game I played as black against Deep HIARCS 14 (computer playing at 1700 Elo) several weeks ago. My endgame technique is getting better!

Thinkin’ bout medium-range polyrhythms.

(DURHAM) Starting to outline a new piece for trio and computer, I find myself once again in front of some nearly-blank A4 sheets on my clipboard, trying to ask the hard questions. What’s the big idea? What’s the global structure, or at least an initial conception of it? Ensemble roles? Texture? Temporal characteristics? What should the computer do?

Of course, these kinds of questions are on my mind all the time. I’ve been preoccupied by the use of medium-range polyrhythms for a couple of years now, first creating them between two pulses in low-integer ratios with a shared pulse unit, most often the quaver. A bit of background: I made a few pieces over several years using shared-quaver pulses of 3:5:7:9 as a local structural determinant (Safety In Numbers, Immortal Witness, Mare Insularum, Mare Orientale), with interesting results. More recently I’ve moved on to experimenting with higher-integer ratios such as 21:25, creating polyrhythms that don’t share a common pulse unit. Mare Marginis, written last summer for the Ives Ensemble, was my most elaborate exploration of this approach, using a polyrhythm of 21:25 which cycled in 35-bar units. This is what I mean by the term “medium-range polyrhythm” – a juxtaposition of two pulse streams which are mutually prime and complete their cycle in some period, usually 30 and 90 seconds of music, which is substantially less than the total duration of the piece.

Working with higher-integer ratios which must be notated for performers brings up several issues, first and foremost the question of beat division and how that will be achieved in a practical way. If one is making music strictly for computer then this is, of course, not an issue at all; the computer can happily perform any polyrhythmic ratios you can imagine, with no thought for irrational values. If you want to divide one beat by 14.35, then you just tell the computer to do it. For human performers, we need to think quite a bit more conservatively, and here is where the interesting challenge comes in: how to coordinate the computer (which can perform complex rhythmic ratios at all temporal levels), with the ensemble, who are pretty much limited to beat divisions (depending on the tempo) of 2, 3, 5 (and their multiples), and 7?

On a totally different note: here is a nice little game which I somehow managed to win after getting myself two pawns down. I was playing against Deep HIARCS 14, when I should have been paying attention to some undergraduate workshops, but never mind:

Better late than never.

(SNODS EDGE) Okay, I finally made a video demo for the piece I wrote for Stichting Conlon at Gaudeamus Muziekweek two years ago. The premiere at the Speelklokmuseum in Utrecht was musically lovely, but visually…not quite, um, no. Two years to get this done! Better late than never. It’s a good piece, I think. It’s AT LEAST worth checking out this video of section 1 and 1a….

YAMAHA / ENIGMA, for Disklavier & electronics. from Chad Langford on Vimeo.


(SNODS EDGE) Just trying a code-block plugin. Here is a game of baccarat I made in SuperCollider, just for fun:

// a little game of baccarat 'chemin de fer' :

~suits = ["H", "D", "C", "S"];
~cards = ["A", 2, 3, 4, 5, 6, 7, 8, 9, "T", "J", "Q", "K"];
d = IdentityDictionary(know: true);
d.putPairs([\A, 1, \T, 0, \J, 0, \Q, 0, \K, 0]);   // associate face card values.

~deck = Array.fill(6, { ~cards +.x ~suits }).flatten;   // create a standard 6-deck shoe.
~discardPile =;  // provide a place for the discards.
~deck = ~deck.scramble;    // shuffle the pack and we're ready to go!

v = { |c| if( c[0].isAlpha, { d[c[0].asSymbol] }, { c[0].digit }) };  /* determine if a card is a facecard or number card.*/

~deal = { ~discardPile.add(~deck[0]); ~p1 = ~deck.removeAt(0);   /* deal the cards to player and banker.*/
	~discardPile.add(~deck[0]); ~b1 = ~deck.removeAt(0);
	~discardPile.add(~deck[0]); ~p2 = ~deck.removeAt(0);
	~discardPile.add(~deck[0]); ~b2 = ~deck.removeAt(0);
	~playerTotal = (v.value(~p1) + v.value(~p2)) % 10;
	~bankerTotal = (v.value(~b1) + v.value(~b2)) % 10;

~playerThirdCard = { ~discardPile.add(~deck[0]); ~p3 = ~deck.removeAt(0);  /* deal (optional) third card to player and banker.*/
	~playerTotal = (~playerTotal + v.value(~p3)) % 10;

~bankerThirdCard = { ~discardPile.add(~deck[0]); ~b3 = ~deck.removeAt(0);
	~bankerTotal = (~bankerTotal + v.value(~b3)) % 10;

~deal.value;  // and now we can play: deal first.

"Player's hand:  "++~p1++" , "++~p2++" // total: "++~playerTotal    // player checks his hand.
~playerThirdCard.value; "Player's hand:  "++~p1++" , "++~p2++" , "++~p3++"  // FINAL total: "++~playerTotal;  /* player takes a third card if desired.*/

"Banker's hand:  "++~b1++" , "++~b2++" // total: "++~bankerTotal   // banker checks his hand.
~bankerThirdCard.value; "Banker's hand:  "++~b1++" , "++~b2++" , "++~b3++"  // FINAL total: "++~bankerTotal;  /* banker takes a third card if desired.*/