nstrnum
Returns an instrument number from a name or definition.
instrnum is another name for this opcode in Csound 7.
Syntax
Initialization
insno -- the instrument number of the named instrument.
"name" is the instrument name. definition is an InstrDef, which can refer to a named or unnamed instrument. Both forms run at initialization.
The definition form accepts an optional numeric iOffset, which defaults to 0 and is added to the instrument number. A fractional offset can identify a particular note when scheduling by number.
If an instrument with the specified name does not exist, an init error occurs, and -1 is returned.
Examples
Here is an example of the nstrnum opcode. It uses the file nstrnum_nstrstr.csd.
The example will produce the following output:
A musical examples featuring the nstrnum opcode: TivalNstrnum_Yi.csd by Steven Yi.
This Csound 7 example uses the instrnum and instrstr spellings with a named definition. It uses instrument-names.csd.
See also
instrnum, nstrstr, str, Instrument definitions, instances and opcode objects
Credits
Author: Istvan Varga
New in version 4.23
Written in the year 2002.
The InstrDef form was added by Victor Lazzarini for Csound 7.