Next: , Previous: Grace Notes (Lisp), Up: Lisp Examples


7.9 Tuplets

7.9.1 Tuplet Durations

You can set the minimum and maximum duration a tuplet is allowed to span with min-tupletdur and max-tupletdur. They are set here as part of the measure definitions because they can't be set at the note level.

(defun notes ()
  (loop
     for i from 0 below 24
     for tim from 0 by 1/3
     do (fms:note :time tim :dur 1/3
                  :pitch (+ 60 (random 13)))))

(defun meass ()
  (fms:meas :time 0 :dur 4 :min-tupletdur 2)
  (fms:meas :time 4 :dur 4 :max-tupletdur 1))

(fms:with-score (:filename *filename*)
  (notes)
  (meass))

lsp062.png

Figure 7.43: Minimum and Maximum Tuplet Durations

7.9.2 Forcing Tuplets

The tup.. and ..tup marks force FOMUS to begin and end a tuplet at those locations, even if it breaks FOMUS's rules determining where tuplets are allowed to occur. The example below uses begin marks to force FOMUS to only begin tuplets at those locations.

(defun notes ()
  (loop
     for i from 0 below 24
     for tim from 0 by 1/3
     for m in '#1=(("tup..") () () . #1#)
     do (fms:note :time tim :dur 1/3
                  :pitch (+ 60 (random 13))
                  :marks m)))

(fms:with-score (:filename *filename*)
  (notes))

lsp021.png

Figure 7.44: Tuplet Begin and End Marks

You can also use the tupletdur and tupletrat settings to fix the duration or ratio of the tuplet:

(defun notes ()
  (loop
     repeat 24
     for tim from 0 by 1/3
     do (fms:note :time tim :dur 1/3
                  :pitch (+ 60 (random 13))
                  :tupletdur (if (< tim 4) 1 2))))

(fms:with-score (:filename *filename*)
  (notes))

lsp020.png

Figure 7.45: Tuplet Durations

It's best to include tupletdur and tupletrat in all note events that might fall underneath the tuplets. Specifying these settings in only a single event, for example, might cause FOMUS to overlook them.

This example shows tuplets being explicitly defined using the marks and settings introduced above:

(defun notes ()
  (loop
     for tim from 0 by 1/5
     and tupcnt from 0
     for tupmod = (mod tupcnt 10)
     while (< tim 8)
     do (fms:note :time tim :dur 1/5
                  :pitch (+ 60 (random 13))
        	  :marks (append (when (= tupmod 0) '("tup.."))
        			 (when (= tupmod 9) '("..tup")))
        	  :sets '(:tupletdur 2 :tupletrat 5/4))))

(fms:with-score (:filename *filename*)
  (notes))

lsp063.png

Figure 7.46: Explicitly Defined Tuplets