instrNames

Contents

instrNames#

csoundengine.csoundlib.instrNames(instrdef)[source]#

Returns the list of names/instrument numbers in the instrument definition.

Most of the time this list will have one single element, either an instrument number or a name

Parameters:

instrdef (str) – the code defining an instrument

Return type:

list[int | str]

Returns:

a list of names/instrument numbers. An empty list is returned if this is not a valid instr definition

Example

>>> instr = r'''
... instr 10, foo
...     outch 1, oscili:a(0.1, 440)
... endin
... '''
>>> instrNames(instr)
[10, "foo"]