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


7.12 Beats and Measures

7.12.1 Beats

The beat setting specifies what rhythmic value is equal to one durational unit or “beat.” By default this value is 1/4, which means a duration of 1 is notated with a quarter note. beat must always be an integer or rational number whose denominator is a power of two (e.g., 1/8, 1/4, 1/2, 1 and 2 are valid values). The following example shows the effect of changing beat to 1/8 (an eighth note).

(defun notes (n)
  (loop
     repeat n
     for tim from 0 by 1
     for p = 60 then (+ p (random 7) -3)
     do (fms:note :part "pno" :time tim :dur 1 :pitch p)))

(fms:with-score
    (:filename *filename*
     :sets '(:beat 1/8)
     :parts '((:id "pno" :inst "piano")))
  (notes 16))

lsp057.png

Figure 7.56: Beats Setting

If you change beat in the middle of a passage, FOMUS adjusts by changing the time signature (i.e., FOMUS does not change the times or durations of measures to compensate—it changes the notation).

(defun notes (n)
  (loop
     repeat n
     for tim from 0 by 1/2
     for p = 60 then (+ p (random 7) -3)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(defun beats (n)
  (loop
     repeat n
     for tim from 0 by 4
     for m in '#1=(1/2 1/4 1/8 . #1#)
     do (fms:meas :time tim :dur 4 :beat m)))

(fms:with-score
    (:filename *filename*
     :parts '((:id "pno" :inst "piano")))
  (notes 29)
  (beats 4))

lsp017.png

Figure 7.57: Beats Setting in the Middle of a Passage

7.12.2 Measures

Measures in FOMUS are defined in a way similar to note events by specifying time and duration along with settings and values. Measures only need to be defined when a change occurs (e.g., a change in the time or key signature) or you want to insure that a downbeat occurs at some specific time. FOMUS fills in the remaining measures by repeating the measure defined by you and adjusting any that overlap or don't fit.

(defun notes (n)
  (loop
     initially (fms:meas :time 0 :dur 3)
     repeat n
     for tim from 0 by 1/2
     for p = 60 then (+ p (random 5) -2)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(fms:with-score
    (:filename *filename*
     :parts '((:id "pno" :inst "piano")))
  (notes 24))

lsp058.png

Figure 7.58: Specifying a Measure

The duration of this measure is 3+1/2 instead of 3. This is notated as an 7/8 measure:

(defun notes (n)
  (loop
     initially (fms:meas :time 0 :dur (+ 3 1/2))
     repeat n
     for tim from 0 by 1/2
     for p = 60 then (+ p (random 5) -2)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(fms:with-score
    (:filename *filename*
     :parts '((:id "pno" :inst "piano")))
  (notes 24))

lsp059.png

Figure 7.59: Specifying a 7/8 Measure

In the following example each small phrase begins on a downbeat. FOMUS begins a new series of 3/4 measures at all of the specified locations while fitting and adjusting the remaining measures in the best way possible.

(defun notes (st n)
  (loop
     repeat n
     for tim from st by 1/2
     for p = 60 then (+ p (random 7) -3)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(fms:with-score
    (:filename *filename*
     :parts '((:id "pno" :inst "piano")))
  (loop
     repeat 5
     for tim = 0 then (+ tim (random 8) 1)
     do
       (fms:meas :time tim :dur 3)
       (notes tim (1+ (random 8)))))

lsp015.png

Figure 7.60: Measures at Arbitrary Locations

When FOMUS needs to create a new measure or delete one to work around the user's explicitly defined measures, it does so according to the min-measdur setting. min-measdur represents the duration of the smallest measure FOMUS is allowed to create.

(defun notes ()
  (loop
     for tim from 0 below 16 by 1/2
     for p in '#1=(60 62 64 65 64 62 60 59 . #1#)
     do (fms:note :time tim :dur 1/2 :pitch p)))

(defun meass ()
  (loop
     for tim from 0 to 12 by 3
     when (/= tim 9)
     do (fms:meas :time tim :dur 4)))

(fms:with-score
    (:filename *filename*
     :sets '(:min-measdur 3))
  (meass)
  (notes))

lsp068.png

Figure 7.61: Minimum Measure Duration

7.12.3 Compound Meter

Compound meter is specified by setting comp to ‘t’. The beat setting is then interpretted as a dotted value. For example, in compound meter a beat setting of 1/4 means a duration of 1 is notated as a dotted quarter note.

(defun notes (n)
  (loop
     initially (fms:meas :time 0 :dur 4 :comp t)
     repeat n
     for tim from 0 by 1/3
     for p = 60 then (+ p (random 5) -2)
     do (fms:note :part "pno" :time tim :dur 1/3 :pitch p)))

(fms:with-score
    (:filename *filename*
     :parts '((:id "pno" :inst "piano")))
  (notes 24))

lsp060.png

Figure 7.62: Specifying Compound Meter

7.12.4 Time Signatures

FOMUS automatically calculates the time signature that appears in the score. This calcaulation can be influenced by changing the value of timesig-den. Setting this to 8 (and beat to 1/4), for example, causes measures of duration 2 to be notated with 4/8 time signatures, measures of duration 3 to be notated with 6/8, etc.. FOMUS changes this to a higher multiple of two if necessary. For example, if timesig-den is 4 then measures of duration 4+1/4 are notated with 17/16 time signatures.

(defun notes (n)
  (loop
     repeat n
     for tim from 0 by 1/2
     for p = 60 then (+ p (random 7) -3)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(defun meass (n)
  (loop
     repeat n
     for tim from 0 by 4
     for m in '#1=(2 4 8 . #1#)
     do (fms:meas :time tim :dur 4 :timesig-den m)))

(fms:with-score
    (:filename *filename*
     :parts '((:id "pno" :inst "piano")))
  (meass 4)
  (notes 29))

lsp016.png

Figure 7.63: Time Signature Denominator Setting

(defun notes (n)
  (loop
     repeat n
     for tim from 0 by 1/2
     for p = 60 then (+ p (random 7) -3)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(defun meass ()
  (loop
     with tim = 0
     for dur in (list 2 (+ 3 1/2) (+ 4 1/4))
     do
       (fms:meas :time tim :dur dur)
       (incf tim dur)))

(fms:with-score
    (:filename *filename*
     :sets '(:timesig-den 8)
     :parts '((:id "pno" :inst "piano")))
  (meass)
  (notes 18))

lsp069.png

Figure 7.64: Another Time Signature Denominator Setting

7.12.5 Explicit Time Signatures

Use the timesig setting if you want to explicitly specify a time signature. When you do this, FOMUS ignores the duration attribute and calculates the duration of the measure from the time signature.

(defun notes (n)
  (loop
     repeat n
     for tim from 0 by 1/2
     for p = 60 then (+ p (random 7) -3)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(defun meass (n)
  (loop
     repeat n
     for tim from 0 by 4
     for m in '#1=((2 2) (4 4) (8 8) . #1#)
     do (fms:meas :time tim :dur 4 :timesig m)))

(fms:with-score
    (:filename *filename*
     :parts '((:id "pno" :inst "piano")))
  (meass 4)
  (notes 29))

lsp018.png

Figure 7.65: Explicit Time Signatures

7.12.6 Measure Divisions

FOMUS uses two settings, meas-divs and default-measdivs to determine how a measure is split or “divided” up into smaller subdivisions. These subdivisions have a direct influence on how notes are split, tied and beamed, and can be controlled so that the right meter is represented in the score.

meas-divs and default-measdivs both contain lists of durations that specify two or more divisions (one division doesn't make any sense). For example, the list ‘(2 2)’ specifies that a measure with a duration of 4 should be divided in half (this represents a typical duple meter). ‘(3 2)’ specifies that a measure with a duration of 5 be divided into a 3 + 2 measure. In meas-divs you can actually specify one or more of these lists—FOMUS then chooses the division that produces the least complex result (i.e., the least number of tied notes and tuplets). For example, setting meas-divs to ‘((3 2) (2 3))’ tells FOMUS that it may choose to divide 5 beats into 3 + 2 or 2 + 3 depending on which one is most suitable.

(defun notes ()
  (loop
     for tim from 0 below 10 by 1/2
     for p in '#1=(60 61 62 63 64 65 64 63 62 61 . #1#)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(defun meass ()
  (fms:meas :time 0 :dur 5/2 :meas-divs '((3 2)))
  (fms:meas :time 5 :dur 5/2 :meas-divs '((2 3))))

(fms:with-score
    (:filename *filename*
     :parts '((:id "pno" :inst "piano")))
  (meass)
  (notes))

lsp071.png

Figure 7.66: Measure Divisions

meas-divs should usually be placed in a measure definition and should only specify divisions specific to that measure. To modify all possible divisions for any measure of any duration use the default-measdivs setting.

(defun notes ()
  (loop
     for tim from 0 below 10 by 1/2
     for p in '#1=(60 61 62 63 64 65 64 63 62 61 . #1#)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(defun meass ()
  (fms:meas :time 0 :dur 5/2)
  (fms:meas :time 5 :dur 7/2))

(fms:with-score
    (:filename *filename*
     :sets '(:default-measdivs ((3 2) (4 3)))
     :parts '((:id "pno" :inst "piano")))
  (meass)
  (notes))

lsp072.png

Figure 7.67: Default Measure Divisions

To change FOMUS's default measure divisions you can also set default-measdivs in your .fomus file located in your home directory.

In most cases, FOMUS uses the same settings to subdivide a measure further after it has initially divided it. For example, once it has divided 5 beats into 3 + 2 beats, it should further subdivide the 3 beats into either 2 + 1, 1 + 2 or 1 + 1 + 1 beats (according to FOMUS's built-in choices). If FOMUS can't find a suitable list of divisions (i.e., the right duration is missing from meas-divs or default-measdivs) it multiplies and/or divides by 2 until it does find one. For example, it might use ‘(3 2)’ to divide 2+1/2 beats into 1+1/2 + 1 if no other list of divisions is provided for a duration of 2+1/2 beats. This allows ‘(3 2)’ to cover measures with 5/8, 5/4 and 5/2 time signatures, for example, regardless of what the value of beat is.

If you are trying to notate any unusual metrical divisions, these features might cause a few subtle quirks. In the first example below, the 1+1/2 + 1+1/2 division specified in meas-divs causes two further 3/4 + 3/4 subdivisions. Since FOMUS does not have a built-in rule for dividing 1+1/2 beats it derives ‘(3/4 3/4)’ from ‘(1+1/2 1+1/2)’ and from this divides each 1+1/2 beat division in half. This is what is causing the strange pattern of rests in the measure below. The problem can be alleviated by providing instructions on how to divide 1+1/2 beats.

(defun notes ()
  (loop
     for tim from 0 below 10 by 1/2
     for p in '#1=(60 61 62 63 64 65 64 63 62 61 . #1#)
     do (fms:note :part "pno" :time tim :dur 1/2 :pitch p)))

(fms:with-score
    (:filename *filename*
     :parts '((:id "pno" :inst "piano")))
  (fms:meas :time 0 :dur 3 :meas-divs '((3/2 3/2)))
  (notes))

lsp073.png

Figure 7.68: Strange Measure Divisions

If there is more than one part, FOMUS tries to divide simultaneous measures the same way. For example, 10 measures starting at time 0 with 5/4 time signatures are all notated as either 3 + 2 or 2 + 3. If you want the possibility of different parts being divided differently, you can assign parts to special metrical groups using the setting divgroup. Basically, all parts with the same divgroup ID are divided the same way, and parts with different divgroup IDs can be divided differently.

TODO: not implemented yet