event/change-times-by-factor [ Functions ]

[ Top ] [ event ] [ Functions ]

Name

 change-times-by-factor

File

 event-transform.lsp

Description

 Modifies all start-time and duration values of all given events
 and subevents by a factor, stretching or compressing their
 the total duration of the given structre.

Arguments

 events: (list or single event  with subevents or comic)
 factor

Return Value

 events

Synopsis

(defun change-times-by-factor (events factor)

Example

(change-times-by-factor (loop-make-event :duration 1 :start-time from 0 to 2) 2)
-->
(#<EVENT, DURATION: #<2.0 SECS>, START-TIME: #<0.0 SECS (0.0 MSECS)>>
 #<EVENT, DURATION: #<2.0 SECS>, START-TIME: #<2.0 SECS>>
 #<EVENT, DURATION: #<2.0 SECS>, START-TIME: #<4.0 SECS>>)

event/distribute-values-by-proc [ Functions ]

[ Top ] [ event ] [ Functions ]

Name

 distribute-values-by-proc

File

 event-transform.lsp

Description

 Assigns given values to a specified event-slot. The given procedure
 (proc) must take an event and two values v1 and v2 and return t if
 v1 fits the event better then v2. The function tries to equally
 distribute all given values to events, while also finding
 a good value for each individual event.

Arguments

 events: (list or single event with subevents or comic)
 values: A list of values that are all of a type expected by the
         specified event-slot.
 event-slot: Name of the slot to fill, a symbol
 proc: A procedure used to sort events, like this:
       (lambda (e v1 v2) ...) --> bool. Returns t if v1 is a better
       match for the slot of e than v2.

Return Value

 events

Synopsis

(defun distribute-values-by-proc (events values event-slot proc)

Example

(distribute-values-by-proc 
   (loop-make-event :duration from 1 to 5)
   '(1 2)
   'start-time 
   (lambda (e v1 v2) (if (u> v1 (duration e) v2) t)))
-->
(#<EVENT, DURATION: #<1.0 SECS>, START-TIME: 1>
 #<EVENT, DURATION: #<2.0 SECS>, START-TIME: 2>
 #<EVENT, DURATION: #<3.0 SECS>, START-TIME: 1>
 #<EVENT, DURATION: #<4.0 SECS>, START-TIME: 2>
 #<EVENT, DURATION: #<5.0 SECS>, START-TIME: 1>)

event/dynamic-transform-events [ Functions ]

[ Top ] [ event ] [ Functions ]

Name

 dynamic-transform-events

File

 event-transform.lsp

Description

 Applies a procedure for transforming events on a list of events
 and their subevents. All numeric properties are then averaged
 between their original and transformed values using a given
 intensity-curve. The values of the intensity curve are arbitrary
 and will be mapped to fit the min and max values of the
 transformation.
 N.B.: Time information are important for this function!
 If they are not set yet, no gradual transformation can be made.

Arguments

 event-proc: A procedure that takes a single event
 intensity-env: a list with values the determine the intensity
                of the transformation
 events: the events (list or single event)

Return Value

 events

Synopsis

(defun dynamic-transform-events (events
                                 event-proc
                                 intensity-env)

Example

(dynamic-transform-events
   (lambda (e)
       (pitch e (u* (pitch e) 2)))
   '(0 0.1 0.3 0.5 0.8 0.9 0.95 1)
   (loop-make-event :start-time below 10 :duration 1 :pitch 1))
--> (#<EVENT, START-TIME: 0, DURATION: 1, PITCH: 1>
     #<EVENT, START-TIME: 1, DURATION: 1, PITCH: 1>
     #<EVENT, START-TIME: 2.0, DURATION: 1.0, PITCH: 1.1>
     #<EVENT, START-TIME: 3.0, DURATION: 1.0, PITCH: 1.3>
     #<EVENT, START-TIME: 4.0, DURATION: 1.0, PITCH: 1.5>
     #<EVENT, START-TIME: 5.0, DURATION: 1.0, PITCH: 1.8>
     #<EVENT, START-TIME: 6.0, DURATION: 1.0, PITCH: 1.8>
     #<EVENT, START-TIME: 7.0, DURATION: 1.0, PITCH: 1.9>
     #<EVENT, START-TIME: 8.0, DURATION: 1.0, PITCH: 1.95>
     #<EVENT, START-TIME: 9, DURATION: 1, PITCH: 2>)

event/interpolate-events [ Functions ]

[ Top ] [ event ] [ Functions ]

Name

 interpolate-events

File

 event-transform.lsp

Description

 Interpolates two events in a given minimal amount of steps. See
 merge-event on infos on how interpolation is done. The amount of
 events returned is always a power-of-2 plus 1 (3, 5, 9, 17, etc.)

Arguments

 e1, e2: two events

Optional Arguments

 min-steps: the function will stop when at least this given amount
 of events was created. 

Return Value

 list of events

Synopsis

(defun interpolate-events (e1 e2 &optional (min-steps 2))

event/merge-events [ Functions ]

[ Top ] [ event ] [ Functions ]

Name

 merge-events

File

 event-transform.lsp

Description

 Merges two events into one:
 - Numeric properties are averaged
 - Subevents are all added to the new event, but not merged
 - the id of the returned event will always be nil
 - pathnames are not merged! The first pathname is taken
 - strings  are concatenated

Arguments

 events

Return Value

 event

Synopsis

(defun merge-events (&rest events)

Example

(merge-events (make-event :pitch 100 :amplitude (amp .5) 
                          :start-time (secs 10)) 
              (make-event :pitch 150 :amplitude .6 
                          :duration (secs 1) 
                          :render-modes 'isis :events (make-event)))
--> #<EVENT, START-TIME: #<10.0 SECS>, DURATION: #<1.0 SECS>, 
      RENDER-MODES: ISIS, PITCH: 125, AMPLITUDE: #<0.55 AMP>,
      events: 1>