schedkwhen
Adds a new score event generated by a k-rate trigger.
Syntax
schedkwhen ktrigger, kmintim, kmaxnum, kinsnum, kwhen, kdur
[, ip4] [, ip5] [...]
schedkwhen ktrigger, kmintim, kmaxnum, "insname", kwhen, kdur \
[, ip4] [, ip5] [...]
Initialization
“insname” -- A string (in double-quotes) representing a named instrument.
ip4, ip5, ... -- Equivalent to p4, p5, etc., in a score i statement
Performance
ktrigger -- triggers a new score event. If ktrigger = 0, no new event is triggered.
kmintim -- minimum time between generated events, in seconds. If kmintim <= 0, no time limit exists. If the kinsnum is negative (to turn off an instrument), this test is bypassed.
kmaxnum -- maximum number of simultaneous instances of instrument kinsnum allowed. If the number of existant instances of kinsnum is >= kmaxnum, no new event is generated. If kmaxnum is <= 0, it is not used to limit event generation. If the kinsnum is negative (to turn off an instrument), this test is bypassed.
kinsnum -- instrument number. Equivalent to p1 in a score i statement.
kwhen -- start time of the new event. Equivalent to p2 in a score i statement. Measured from the time of the triggering event. kwhen must be >= 0. If kwhen > 0, the instrument will not be initialized until the actual time when it should start performing.
kdur -- duration of event. Equivalent to p3 in a score i statement. If kdur = 0, the instrument will only do an initialization pass, with no performance. If kdur is negative, a held note is initiated. (See ihold and i statement.)
Note
While waiting for events to be triggered by schedkwhen, the performance must be kept going, or Csound may quit if no score events are expected. To guarantee continued performance, an f0 statement may be used in the score.
Note
Note that the schedkwhen opcode cannot accept string p-fields. If you need to pass strings when instantiating an instrument, use the scoreline or scoreline_i opcode.
Examples
Here is an example of the schedkwhen opcode. It uses the file schedkwhen.csd.
A musical example featuring the schedkwhen opcode: schedkwhen_Daughtrey.csd by Scott Daughtrey.
See also
Credits
Author: Rasmus Ekman
EMS, Stockholm, Sweden
Example written by Kevin Conder.
New in Csound version 3.59