instr Orchestra Syntax:Block Statements instr instr Starts an instrument block. Description Starts an instrument block. Syntax instr i, j, ... Initialization Starts an instrument block defining instruments i, j, ... i, j, ... must be numbers, not expressions. Any positive integer is legal, and in any order, but excessively high numbers are best avoided. Note There may be any number of instrument blocks in an orchestra. Instruments can be defined in any order (but they will always be both initialized and performed in ascending instrument number order, with the exception of notes triggered by real time events that are initialized in the order of being received but still performed in ascending instrument number order). Instrument blocks cannot be nested (i.e. one block cannot contain another). Performance Calling an Instrument within an Instrument You can call an instrument within an instrument as if it were an opcode either with the subinstr opcode or by specifying an instrument with a text name: instr MyOscil ... endin If an instrument is defined with a name, you simply call it directly like an opcode: asig MyOscil iamp, ipitch, iftable By default, all output parameters correspond to the called instrument's output with the signal output opcodes. All input parameters are mapped to the called instrument's p-fields starting with the fourth one, p4. The values of the called instrument's second and third p-fields, p2 and p3, are automatically set to those of the calling instrument's. A named instrument must be defined before any instrument that calls it. Hint If you use the outc opcode, you can create an instrument that will compile and function in any orchestra of any number of channels greater than or equal to the output channels of the instrument. A nice feature to use with named instruments is the #include feature. You can then define your named instruments in separate files, using #include when you need to use one. Examples Here is an example of the instr opcode. It uses the file instr.csd. Example of the instr opcode. See the sections Real-time Audio and Command Line Flags for more information on using command line flags. See Also endin, in, out, opcode, endop, setksmps, xin, xout, subinstr, subinstrinit Credits Example written by &namekevin;.