Next: , Previous: Beats and Measures (Lisp), Up: Lisp Examples

7.13 Treating Multiple Parts as One

7.13.1 Metapart Example

You can treat multiple instruments as one by defining a “metapart.” Metaparts don't appear in the score. Instead, they route events to other parts or metaparts according to which voices they are in. The from-voice and to-voice settings tell FOMUS how to do this. In the example below, events belonging to voice 1 in the ‘vla’ metapart are routed to voice 1 of ‘vla1’, events in voice 2 are routed to ‘vla2’ and events in voice 3 are routed to ‘vla3’. This is done after one of the three voices (1, 2 or 3) has been chosen for each note. Defining the ‘vla’ metapart this way allows the events for the three viola parts to be entered as chords instead of as separate melodic lines.

(defparameter *parts*
  '((:id "vla1" :inst "viola")
    (:id "vla2" :inst "viola")
    (:id "vla3" :inst "viola")))

(defparameter *metaparts*
  '((:id "vla" :parts ((:part "vla1" :from-voice 1 :to-voice 1)
                       (:part "vla2" :from-voice 2 :to-voice 1)
                       (:part "vla3" :from-voice 3 :to-voice 1)))))

(defun notes (reps dur pset)
     with pat = (loop repeat reps
                   nconc (sort (copy-list pset)
                               (lambda (x y)
                                 (declare (ignore x y))
                                 (< (random 1.0) 0.5))))
     for c = (pop pat)
     for tim from 0 by dur
     while c
     do (loop
           for k in c
           do (fms:note :time tim :dur dur
                        :pitch k :part "vla"
                        :voice '(1 2 3)))))

    (:filename *filename*
     :parts *parts* :metaparts *metaparts*)
  (notes 10 1/4 '((60 62 64) (61 63 65) (62 64 66))))


Figure 7.69: Viola Trio Metapart

TODO: show nested metaparts with transpositions