orc = '''sr = 44100 ksmps = 32 nchnls = 1 0dbfs = 1 instr 1 idur = p3 iamp = p4 ipch = cpspch(p5) iatk = p6 irel = p7 k1 linen iamp, iatk, idur, irel a1 oscil k1, ipch, 1 a2 oscil k1, ipch*.997, 1 a3 oscil k1, ipch*1.004, 1 out (a1+a2+a3)*.333 endin''' sco = 'f1 0 {0} -7 -1 {0} 1\n'.format(2**24) start = 0 def chord(dur, amp, notes, atk, rel): global start, sco for i in range(len(notes)): sco += 'i1\t{:.3f}\t{:.3f}\t{:.3f}\t{:.2f}\t{:.1f}\t{:.1f}\n'.format(start, dur, amp/len(notes), notes[i], atk, rel) start += dur def rest(dur): global start start += dur chord(5, 1, [7,8,8.03,9,6,6.07], 1,4) chord(5,.7,[6.05,7,7.05,8,8.03,8.08,9,10],.1,.4) rest(2) chord(15,1,[5.07,6.07,7.07,7.11, 8.02,8.09,8.11,9.02,9.07],1,3) csd = open('chord_demo.csd','w') csd.write( ''' -odac -dm0 -b4096 -B4096 {} {} '''.format(orc, sco))