Next: , Previous: Settings (Lisp), Up: Lisp Examples


7.3 Voices, Chords and Polyphony

7.3.1 Voices

Use the voice parameter to specify a voice (numbering starts at 1 and continues up to 128, more than can possibly fit on a staff). If you don't specify one, the default value is 1.

If you explicitly assign voices to note events, keep in mind that the lowest voice number is usually the highest on the staff and vice versa.

(fms:with-score (:filename *filename*)
  (loop
     with h = (let ((x (list 0 3 4 6 8)))
                (loop repeat 10 nconc (sort (copy-list x)
                                	    (lambda (x y)
                                	      (declare (ignore x y))
                                	      (< (random 1.0) 0.5)))))
     for o from 0 below 12 by 1/2
     do
       (fms:note :time o :dur 1/2 :pitch (+ 67 (pop h)) :voice 1)
       (fms:note :time o :dur 1/2 :pitch (+ 55 (pop h)) :voice 2)))

lsp033.png

Figure 7.15: Voices

7.3.2 Polyphony

FOMUS is given a choice between several voices here by passing a list to the voice parameter.

(fms:with-score
    (:filename *filename*
     :parts '((:id "apart" :inst "piano")))
  (loop
     repeat 10
     for tim = (random 20.0)
     and dur = (+ 1 (random 3.0))
     do (fms:note :time tim
                  :dur dur
                  :pitch (+ 60 (random 25))
                  :voice '(1 2 3))))

lsp007.png

Figure 7.16: Polyphony 1

(defun notes (len minp maxp)
  (loop
     repeat len
     for tim from 0 by 1/4
     do (fms:note :time tim
                  :dur 1/4
                  :pitch (+ minp (random (- maxp minp)))
                  :voice '(1 2))))

(fms:with-score
    (:filename *filename*
     :parts '((:id "apart" :inst "piano")))
  (notes 40 50 80)
  (notes 40 40 70))

lsp013.png

Figure 7.17: Polyphony 2

7.3.3 Chords

Chords are formed when simultaneous or overlapping notes exist in a single voice. In the following example, FOMUS finds it appropriate to create chords in one voice even though it is given a choice:

(fms:with-score
    (:filename *filename*
     :parts '((:id "apart" :inst "piano")))
  (loop repeat 3
     do (loop
           for off from 0 to 10 by 1/2
           do (fms:note :time off
                        :dur (if (< off 10) 1/2 1)
                        :pitch (+ 48 (random 25))
                        :voice '(1 2)))))

lsp005.png

Figure 7.18: Chords 1

In this example, FOMUS is forced to fit everything into one voice. FOMUS has no choice but to form chords in this case.

(fms:with-score
    (:filename *filename*
     :parts '((:id "apart" :inst "piano")))
  (loop
     repeat 10
     for tim = (random 30.0)
     and dur = (+ 1 (random 3.0))
     do (fms:note :time tim
                  :dur dur
                  :pitch (+ 60 (random 25)))))

lsp006.png

Figure 7.19: Chords 2

FOMUS uses a setting called vertmax to determine the maximum number of notes allowed in a chord. For most instruments the appropriate value is 1. FOMUS needs this information when it chooses voices so that it doesn't notate passages that are impossible to play. The place to put vertmax is in an instrument or part definition, though it may also be changed for individual measures or notes.

In the following example, setting vertmax to 1 in the part definition overrides the default of 5 that is defined in the instrument. This forces the output to consist of two individually monophonic voices.

(fms:with-score
    (:filename *filename*
     :parts '((:id "prt1" :inst "piano" :vertmax 1))) ; overrides `vertmax' in piano instrument
  (loop
     with h = (let ((x (list 50 56 61 67)))
                (loop repeat 20 nconc (sort (copy-list x)
                                	    (lambda (x y)
                                	      (declare (ignore x y))
                                	      (< (random 1.0) 0.5)))))
     for o from 0 below 12 by 1/2
     do
       (fms:note :part 'prt1 :time o :dur 1/2 :pitch (pop h) :voice '(1 2))
       (fms:note :part 'prt1 :time o :dur 1/2 :pitch (pop h) :voice '(1 2))))

lsp032.png

Figure 7.20: vertmax Setting