A UGen which reads a signal from an audio bus with a current or one cycle old timestamp.
Audio buses adhere to the concept of a cycle timestamp, which increases for
each audio block calculated. When the various output ugens ( Out
, OffsetOut
, XOut
) write data to a bus, they mix it with any data from the current
cycle, but overwrite any data from the previous cycle. ( ReplaceOut
overwrites
all data regardless.) Thus depending on node order and what synths are writing
to the bus, the data on a given bus may be from the current cycle or be one
cycle old at the time of reading.
In.ar
checks the timestamp of any data it reads in and zeros any data from
the previous cycle (for use within that node; the data remains on the bus). This
is fine for audio data, as it avoids feedback, but for control data it is useful
to be able to read data from any place in the node order. For this reason
In.kr
also reads data that is older than the current cycle.
In some cases one might also want to read audio from a node later in the
current node order. This can be achieved with InFeedback
. It reads from the
previous cycle, and hence introduces a '''delay''' of one block size, which by
default is 64 sample frames (equal to about 1.45 ms at 44.1 kHz sample rate).
'''Note''' that no delay occurs when the bus contains a signal which has been written already in the current cycle. The delay is only introduced when no present signal exists.
===Examples===
// feedback frequency modulation
play {
val in = InFeedback.ar(0) // read output
SinOsc.ar(in * 1300 + 300) * 0.4
}
// resonator
val bus = Bus.audio(s) // internal feedback bus
val x = play {
val imp = Impulse.ar(1)
val in = InFeedback.ar(bus.index)
val feed = imp + in * 0.995
// must subtract block-size for correct tuning
// (try removing the ControlDur to here the pitch change)
val time = 440.reciprocal - ControlDur.ir
val dly = DelayC.ar(feed, time, time)
Out.ar(bus.index, dly)
// alternate between feedback and reference pitch
val comp = Seq(dly, SinOsc.ar(440) * 0.2): GE
comp * LFPulse.kr(1, Seq(0.0, 0.5))
}
x.free(); bus.free() // do not forget to free the bus eventually
- See also
- Companion
- class