from os import system from time import sleep L = [] startSyn,stopSyn='<CsoundSynthesizer>','</CsoundSynthesizer>' startOpt,stopOpt='<CsOptions>','</CsOptions>' startIns,stopIns='<CsInstruments>','</CsInstruments>' startSco,stopSco='<CsScore>','</CsScore>' def add(*b): """ Adding terms to csd file """ L.extend(b) def header(sr=44100,ksmps=10,nch=2,amp=1): """ Generates 4 headers in the orchesta section """ L.append('sr = %d' % sr) L.append('ksmps = %d' % ksmps) L.append('nchnls = %d' % nch) L.append('0dbfs = %d' % amp) def writeRun(fname, run=True): """ Write out the csd file and perform it """ fname = fname[:-3] OutL=[Lu + '\n' for Lu in L] out = open('%s.csd' % fname,'w') out.writelines(OutL) out.close() sleep(1) cmd = 'csound -W -o %s.wav %s.csd' % (fname,fname) if run: status=system(cmd) if status!=0: raise Exception ('Could not write wav file') def tags(k): """ Enter tags. """ if k == 1: add(startSyn,startIns) elif k == 2: add(stopIns,startSco) elif k == 3: add(stopSco,stopSyn)
moduleCsound.py
Subscribe to:
Posts (Atom)
-
Amplitudes should follow the dB scale and change via the log function. # ex1C01.py # dB vs linear from moduleCsound import * tag...
-
# ex1D09.py # Random Walk from moduleCsound import * tags( 1 ) header(ksmps =32 ) # --- globals add( r""" seed 1...
-
# ex2C03.py # Midi All In from moduleCsound import * add(startSyn) add(startOpt) add( "-+rtmidi=virtual -Ma -odac" ) add(...
No comments:
Post a Comment