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


7.11 Percussion

7.11.1 Percussion Examples

Percussion instruments appearing on the same staff can be assigned notes and voices. The percussion instrument ID is then specified instead of a pitch to place a note in the proper location.

To set up a group of percussion instruments for a part, you must create an inst object that contains one or more percinst objects. The following example shows a simple setup using the perc-note setting in each percussion definition to assign to it a specific note on the staff. Percussion instruments are defined separately and are included in the ‘pinst’ instrument by referencing their IDs.

(defun notes ()
  (loop
     for o from 0 to 20 by 1/2
     do (fms:note :time o :dur 1/2
                  :pitch (if (< (random 1.0) 0.5) "wb1" "wb2"))))

(fms:with-score
    (:filename *filename*
     :percinsts '((:id "wb1" :template "low-woodblock" :perc-note 57)
                  (:id "wb2" :template "high-woodblock" :perc-note 64))
     :insts '((:id "pinst" :template "percussion" :percinsts ("wb1" "wb2")))
     :parts '((:id "perc" :name "Percussion" :inst "pinst")))
  (notes))

lsp009.png

Figure 7.52: High/Low Woodblocks

The percussion instrument definitions are changed in this example so that the woodblocks are notated in separate voices.

(defun notes ()
  (loop
     for o from 0 to 20 by 1/2
     do (fms:note :time o :dur 1/2
                  :pitch (if (< (random 1.0) 0.5) "wb1" "wb2"))))

(fms:with-score
    (:filename *filename*
     :percinsts '((:id "wb1"
                   :template "low-woodblock"
                   :perc-note 57
                   :perc-voice 2)
                  (:id "wb2"
                   :template "high-woodblock"
                   :perc-note 64
                   :perc-voice 1))
     :insts '((:id "pinst" :template "percussion" :percinsts ("wb1" "wb2")))
     :parts '((:id "perc" :name "Percussion" :inst "pinst")))
  (notes))

lsp010.png

Figure 7.53: Percussion with Voice Assignments

The following uses inlined percinst and inst definitions but is otherwise equivalent to the example above:

(defun notes ()
  (loop
     for o from 0 to 20 by 1/2
     do (fms:note :time o :dur 1/2
                  :pitch (if (< (random 1.0) 0.5) "wb1" "wb2"))))

(fms:with-score
    (:filename *filename*
     :parts '((:id "perc" :name "Percussion"
               :inst (:template "percussion" :percinsts
                      ((:id "wb1"
                        :template "low-woodblock"
                        :perc-note 57
                        :perc-voice 2)
                       (:id "wb2"
                        :template "high-woodblock"
                        :perc-note 64
                        :perc-voice 1))))))
  (notes))

lsp055.png

Figure 7.54: Inlined Percussion and Instrument Definitions

If perc-name is set inside a percussion instrument definition, FOMUS places this name above the staff whenever there is a change from one percussion instrument to another.

(defun notes ()
  (loop
     for o from 0 to 20 by 1
     do (fms:note :time o :dur 1
                  :pitch (if (< o 12) "bdr" "cym"))))

(fms:with-score
    (:filename *filename*
     :percinsts '((:id "bdr" :perc-note 60 :perc-name "B. Drum")
                  (:id "cym" :perc-note 60 :perc-name "Cymbal"))
     :insts '((:id "pinst" :template "percussion" :percinsts ("bdr" "cym")))
     :parts '((:id "perc" :name "Percussion" :inst "pinst")))
  (notes))

lsp056.png

Figure 7.55: Percussion Changes

7.11.2 Percussion Library

If you find yourself reusing the same percussion instrument definitions, you could insert something resembling the following in your .fomus file located in your home directory (make sure you use ‘+=’ instead of ‘=’ to append the values to FOMUS's default list).

     percinst-defs += (<id cym, perc-note c4, perc-name "Cymbal">
                       <id bdr, perc-note c4, perc-name "B. Drum">)

All of FOMUS's built-in percussion instruments are contained in the file fomus.conf, which is located in /install_prefix/shared/ (install_prefix is most likely /usr/local or /usr).