Thursday, October 05, 2006
close to finished return instrument numbers (python csound routine)
This is close to finished I am just getting the very last instrument for some reason but all the commands work. I just need to coax it into an array and fix the re.
ref return_instr_numbers(from_file):
"returns a list of .csd instruments and any comments from the instr line"
infile = open(from_file, 'r')
for line in infile:
if 'instr' in line:
s = re.split(r' ',line,3)
instr_number = s[1]
return instr_number
requires the following at the top
import re
import strings
I am just getting the last on with the comment together so there is some work to be done with this but it is very very close..
ref return_instr_numbers(from_file):
"returns a list of .csd instruments and any comments from the instr line"
infile = open(from_file, 'r')
for line in infile:
if 'instr' in line:
s = re.split(r' ',line,3)
instr_number = s[1]
return instr_number
requires the following at the top
import re
import strings
I am just getting the last on with the comment together so there is some work to be done with this but it is very very close..