In.ar and In.kr read signals from audio and control buses, respectively. (See the Busses chapter of the Getting Started tutorial series for details on buses.)
In.ar and In.kr behave slightly differently with respect to signals left on the bus in the previous calculation cycle.
In.ar can access audio signals that were generated in the current calculation cycle by Synth nodes located earlier in the node tree (see Order of execution). It does not read signals left on an audio bus from the previous calculation cycle. If synth A reads from audio bus 0 and synth B writes to audio bus 0, and synth A is earlier than synth B, In.ar in synth A will read 0's (silence). This is to prevent accidental feedback. InFeedback supports audio signal feedback.
In.kr is for control buses. Control signals may be generated by Synth nodes within the server, or they may be set by the client and expected to hold steady. Therefore, In.kr does not distinguish between "new" and "old" data: it will always read the current value on the bus, whether it was generated earlier in this calculation cycle, left over from the last one, or set by the client.
Note that using the Bus class to allocate a multichannel bus simply reserves a series of adjacent bus indices with the Server object's bus allocators. abus.index
simply returns the first of those indices.
When using a Bus with an In or Out UGen there is nothing to stop you from reading to or writing from a larger range, or from hardcoding to a bus that has been allocated. You are responsible for making sure that the number of channels match and that there are no conflicts. See the Server Architecture and Bus helpfiles for more information on buses and how they are used.
The hardware input busses begin just after the hardware output busses and can be read from using In.ar (See Server Architecture for more details). The number of hardware input and output busses can vary depending on your Server's options. For a convenient wrapper class which deals with this issue see SoundIn .
bus |
The index of the bus to read in from. |
numChannels |
The number of channels (i.e. adjacent buses) to read in. You cannot modulate this number by assigning it to an argument in a SynthDef. |
read from an audio bus:
read from a control bus:
read control data from a synth later in the node order: