SimpleAlgorithmicSequencing

From XPUB & Lens-Based wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Simple Algorithmic Sequencing

#!/usr/bin/python
import os

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

def do (cmd):
	os.system(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")
			else:
				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")