Friday, August 01, 2008
changing table numbers csound command line program
In order to combine .sco and .orc files that contain tables the table numbers will have to change and the tables after the first instrument will have to be moved.
The following is a beta in the python programming language to change the table numbers in the .orc file.. some examples in the manual use a constant instead of assigning a number.. that shouldn't be a problem.. Other files may be though.
import sys
opcode = sys.argv[0]
tablenumber = sys.argv[1]
newtablenumber = str(sys.argv[2])
inputfile = open(sys.argv[3], 'r')
outputfile = open(sys.argv[4], 'w')
for line in inputfile:
if opcode in line:
if opcode == 'oscil':
count = 0
for word in line:
count = count + 1
if count == 5
word == newtablenumber
outputfile.write(line)