subinstrinit
Prev | Orchestra Opcodes and Operators | Next

## subinstrinit

subinstrinit — Creates and runs a numbered instrument instance at init-time.

## Description

Same as subinstr, but init-time only and has no output arguments.

## Syntax

    subinstrinit instrnum [, p4] [, p5] [...]

    subinstrinit "insname" [, p4] [, p5] [...]

## Initialization

instrnum -- Number of the instrument to be called.

“insname” -- A string (in double-quotes) representing a named instrument.

p4, p5, ... -- Additional input values the are mapped to the called instrument p-fields, starting with p4.

The called instrument's p2 and p3 values will be identical to the host instrument's values. While the host instrument can control its own duration, any such attempts inside the called instrument will most likely have no effect.

## Examples

Here is an example of the subinstrinit opcode. It uses the file subinstrinit.csd.

Example 1054. Example of the subinstrinit opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    ; Audio out   Audio in
    -odac           -iadc    ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:

    ; By Stefano Cucchi 2020

    </CsOptions>
    <CsInstruments>

    ; Initialize the global variables.
    sr = 44100
    ksmps = 32
    nchnls = 2
    0dbfs  = 1

    instr 1
    subinstrinit p4
    endin

    instr 2
    prints "instr. 2 playing\n"
    endin

    instr 3
    prints "instr. 3 playing\n"
    endin

    instr 4
    prints "instr. 4 playing\n"
    endin

    </CsInstruments>
    <CsScore>

    i1 0 2 2
    i1 2 2 3
    i1 4 2 4

    e

    </CsScore>
    </CsoundSynthesizer>

Its output should include lines like this:

    instr. 2 playing
    B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.00000  0.00000
    instr. 3 playing
    B  2.000 ..  4.000 T  4.000 TT  4.000 M:  0.00000  0.00000
    instr. 4 playing
    B  4.000 ..  6.000 T  6.000 TT  6.000 M:  0.00000  0.00000
      .........

## See Also

event, schedule, subinstr

## Credits

New in version 4.23

Prev | Up | Next
subinstr | Home | sum