import fart #import oil import nuclear import wave import pickle from array import array import struct how_many_samples = 44100 * 300 smoothie = 55 #nuc = [ [pickle.load(open("plutonium")),1,[100,100]], #nuc = [ [fart.Zero(),0,[100,100]], nuc = [ [fart.One(),1,[70,70]], # [fart.One(),0,[123,123]], # [fart.Two(),0,[123,123]], # [fart.Three(),0,[200,200]], # [fart.Four(),0,[200,200]], # [fart.Five(),0,[300,300]], # [fart.Six(),0,[300,300]], # [fart.Seven(),0,[300,300]], # [fart.Eight(),0,[500,500]], # [fart.Nine(),0,[123,123]], #nuc = [ [nuclear.Zero(),0,[100,100]], # [nuclear.Zero(),0,[300,300]], # [nuclear.One(),0,[123,123]], # [nuclear.Two(),0,[222,222]], [nuclear.Three(),0,[200,200]], [nuclear.Four(),0,[200,200]], [nuclear.Five(),3,[500,500]], [nuclear.Six(),0,[500,500]], [nuclear.Seven(),2,[500,500]], # [nuclear.Seven(),0,[500,500]]] [nuclear.Eight(),0,[500,500]], [nuclear.Nine(),0,[500,500]]] n_len = len(nuc) # [nuc,switch,[smoothie,smaller the bigger]] # 0=free 1=fixed 2=can only - (getbigger) 3= can only + (get smaller) def l2h(thang): h_thang = array('h') l_thang = len(thang) for gas in range(l_thang): h_thang.append(thang[gas]) return h_thang filter = 35753 stereo = [0,0] a_stereo = [32767,32767] for f in range(how_many_samples-1): for n in nuc: song = n[0].sing() if n[1] > 9: continue for s in range(2): if song > 0: v = (65534-a_stereo[s])/float(n[2][s]) else: v = a_stereo[s]/float(n[2][s]) a_stereo[s] = a_stereo[s]+int(v*song) w = (s*n[2][s]+a_stereo[s])%n_len if n[2][s] > smoothie and n[2][s] != n[2][(s+1)%2]+1 and nuc[w][2][s] != nuc[w][2][(s+1)%2]-1: if n[1] != 1 and n[1] != 3 and nuc[w][1] != 1 and nuc[w][1] != 2: n[2][s] = n[2][s]-1 nuc[w][2][s] = nuc[w][2][s]+1 if n[2][s]-1==smoothie and nuc[w][1] < 10: n[1] = 1 nuc[w][1] = 12 stereo.append(a_stereo[0]-32767) stereo.append(a_stereo[1]-32767) h = (f+a_stereo[0]+a_stereo[1])%filter if h == 5434: guy = a_stereo[0]%n_len gal = a_stereo[1]%n_len print guy,"fuck",gal nuc[guy][0].fuck(nuc[gal][0]) if nuc[guy][1] > 10: nuc[guy][1] = nuc[guy][1]-10 else: nuc[guy][1] = nuc[guy][1]+10 if nuc[gal][1] > 10: nuc[gal][1] = nuc[gal][1]-10 else: nuc[gal][1] = nuc[gal][1]+10 elif h == 333: w = a_stereo[0]%n_len nuc[w][0].reincarnate(a_stereo[1]) nuc[w][1] = a_stereo[1]%4 if f % 44100 == 0: print f/44100, "/", how_many_samples/44100 print "[", a_stereo[0], a_stereo[1], "]" for n in nuc: print n[2], print for f in range(44100): stereo[-2*f-1] = int(stereo[-2*f-1]*(f/44100.0)) stereo[-2*f-2] = int(stereo[-2*f-2]*(f/44100.0)) # need fade out track_thang = l2h(stereo) a_thang = wave.open("radiation.wav", "w") a_thang.setnchannels(2) a_thang.setsampwidth(2) a_thang.setframerate(44100) a_thang.writeframes(track_thang.tostring()) a_thang.close() #print "dumping plutonium" #pickle.dump(nuc[0],open("plutonium","w")) print "done"