active Instrument Control:Realtime Performance Control active active Returns the number of active instances of an instrument. Description Returns the number of active instances of an instrument with options to ignore releasing instances. Syntax ir active insnum [,iopt [,inorel]] ir active Sinsname [,iopt [,inorel]] kres active kinsnum [,iopt [,inorel]] Initialization insnum -- number or string name of the instrument to be reported Sinsname -- instrument name iopt -- select currently active (zero, default), or all every active (non zero) inorel -- if non-zero ignore instruments in release phase (zero, default), only valid if iopts is zero. Performance kinsnum -- number or string name of the instrument to be reported active returns the number of active instances of instrument number insnum/kinsnum (or named instrument Sinsname). As of Csound 4.17 the output is updated at k-rate (if input arg is k-rate), to allow running count of instr instances. As of Csound 5.17 if the instrument number is given as zero then all instruments are counted. Examples Here is a simple example of the active opcode. It uses the file active.csd. Simple example of the active opcode. See the sections Real-time Audio and Command Line Flags for more information on using command line flags. Its output should include lines like this: instr 2: icount = 1.000 instr 2: icount = 2.000 Here is a more advanced example of the active opcode. It displays the results of the active opcode at k-rate instead of i-rate. It uses the file active_k.csd. Example of the active opcode at k-rate. Its output should include lines like: i2 1.00000 i2 2.00000 Here is another example of the active opcode, using the number of instances to calculate gain. It uses the file active_scale.csd. Example of the active opcode at k-rate. See also Real-time Performance Control Credits Author: &namejohn; University of Bath/Codemist Ltd. Bath, UK July, 1999 Examples written by &namekevin;. New in Csound version 3.57; named instruments added version 5.13 Option for all ever active new in 5.13 Count of all instruments new in 5.17 No release option new in 5.19