instrParseBody#
- csoundengine.csoundlib.instrParseBody(body)[source]#
Parses the body of an instrument, returns pfields used, output channels, etc.
- Parameters:
body (str) – the body of the instr (between instr/endin)
- Return type:
- Returns:
a ParsedInstrBody
Example
>>> from csoundengine import csoundlib >>> body = r''' ... pset 0, 0, 0, 1, 1000 ... ibus = p4 ... kfreq = p5 ... a0 = busin(ibus) ... a1 = oscili:a(0.5, kfreq) * a0 ... outch 1, a1 ... ''' >>> csoundlib.instrParseBody(body) ParsedInstrBody(pfieldsIndexToName={4: 'ibus', 5: 'kfreq'}, pfieldLines=['ibus = p4', ['kfreq = p5'], body='\na0 = busin(ibus)\n a1 = oscili:a(0.5, kfreq) * a0\noutch 1, a1', pfieldsDefaults={1: 0.0, 2: 0.0, 3: 0.0, 4: 1.0, 5: 1000.0}, pfieldsUsed={4, 5}, outChannels={1}, pfieldsNameToIndex={'ibus': 4, 'kfreq': 5})