ParsedInstrBody#

class csoundengine.csoundlib.ParsedInstrBody(pfieldIndexToName, pfieldLines, body, lines, pfieldIndexToValue=None, pfieldsUsed=None, outChannels=None)[source]#

Bases: object

The result of parsing the body of an instrument

This is used by instrParseBody()

Attributes Summary

outChannels

Which output channels are used

pfieldIndexToValue

Default values of the pfields, by pfield index

pfieldNameToIndex

Maps pfield name to its index

pfieldNameToValue

Dict mapping pfield name to default value

pfieldsText

The text containing pfield definitions

pfieldsUsed

Which pfields are accessed

Methods Summary

numPfields()

Returns the number of pfields in this instrument

Attributes Documentation

outChannels: set[int] | None = None#

Which output channels are used

pfieldIndexToValue: dict[int, float] | None = None#

Default values of the pfields, by pfield index

pfieldNameToIndex#

Maps pfield name to its index

pfieldNameToValue#

Dict mapping pfield name to default value

If a pfield has no explicit name assigned, p## is used. If it has no explicit value, 0. is used

Example

Given a csound instr:

>>> parsed = instrParseBody(r'''
... pset 0, 0, 0, 0.1, 400, 0.5
... iamp = p4
... kfreq = p5
... ''')
>>> parsed.pfieldNameToValue
{'iamp': 0.1, 'kfreq': 400, 'p6': 0.5}
pfieldsText#

The text containing pfield definitions

pfieldsUsed: set[int] | None = None#

Which pfields are accessed

Methods Documentation

numPfields()[source]#

Returns the number of pfields in this instrument

Return type:

int