When a composer writes a piece for an interactive installation the
duration of the activities can depend on user actions. In that
case, the duration is unknown at the time of the composition. Duda &
Keramane propose the use of causal relations between activities
[DK94,KD97].
The definition of causal relations in the proposed environment rests
on two features:
- The start and end of an activity is defined by a
program,
- We can define the sequential application of the start
and end programs in the Scheme interpreter.
Below we give a short example of the sequential structure, this time
based upon a causal relation. We define two activities a and
b. The duration of a is set arbitrarily long. We use
fictive procedures for the start end stop programs of a and b.
(define very-long 1000000)
(define a (activity 0 very-long start-a () stop-a ()))
(define b (activity 0 5 start-b () stop-b ()))
We define a help procedure, fun-compose, that realizes the
sequential application of the procedures (with arguments) given as
parameter:
(define (fun-compose p1 a1 p2 a2)
(apply p1 a1)
(apply p2 a2))
With the function above we can define the causal sequential structure
as follows: (The constant #!null is defined by the Kawa
implementation and is equal to the null value in Java.)
(define (causal-sequence a b)
(let ((start-prog-a (get-start-prog a))
(start-arg-a (get-start-arg a))
(stop-prog-a (get-stop-prog a))
(stop-arg-a (get-stop-arg a))
(start (get-activity-start a))
(dur (+ (get-activity-duration a)
(get-activity-duration b))))
(set-stop-prog! a fun-compose)
(set-stop-arg! a stop-prog-a stop-arg-a play b)
(activity start dur start-prog-a start-arg-a #!null ())))
(play (causal-sequence a b))
The function causal-sequence returns a new activity that can
again be included into other structures. When the causal sequence is
played, the end of activity a is determined by an event coming
from an external source. The stop program of a causes both a to stop and b to start playing. The example shows the
advantage of using a high-level interpreter. The expert user who wants
to describe a more complex behavior of the system can pick up the code
above and dynamically redefine the relations.
So far, we have discussed activities, patterns, and motifs. We dealt
with discrete times only: the time locations and durations of
activities. In the next section we will consider continuous time.