From Media Design: Networked & Lens-Based wiki
Jump to navigation Jump to search

Simple Algorithmic Sequencing

import os

pat1 = "ooo.oo.o.oo."
pat2 = pat1

def do (cmd):

do("rm tmp.raw")

for i in range(13):
	print pat1
	print pat2
	print "----"

	for i in range(4):
		for (a, b) in zip(pat1, pat2):
			if a=="o" and b=="o":
				do("cat tones/sample.raw >> tmp.raw")
			elif a=="o" or b=="o":
				do("cat tones/lo.raw >> tmp.raw")
				do("cat tones/silence.raw >> tmp.raw")

	pat2 = pat2[1:]+pat2[0]

do("cat tmp.raw | sox -t raw -r 44100 -sw -c 2 - -t .wav pat.wav")
do("rm tmp.raw")