Class
cmnHolds note and staff expressions (variables and function calls) to manuscript with CMN streams.
cmn supports the following slot initializations:
:time number:staff number :expr expr :duration for the object is
specfied then a new CMN note definition is added to the staff at the
current score time. Otherwise, the value of :expr can be any CMN expression (function call
list or variable name) to add to the staff. For sake of clarity the
:expr initialzation can also be specified
as :note.
:duration number:note
definition.
:data listExample 1. CMN expressions.
;;; a meter expression (new cmn :time 0 :expr '(meter 3 4)) ;;; a note defintion (new cmn :time 0 :note 'c4 :duration 3) ;;; a note in staff 3 with markup added (new cmn :staff 3 :expr 'c4 :duration .5 :data '(accent ff))
Example 2. Outputting CMN objects to scores.
(new seq :name 'sevens :subobjects (list (new cmn :time 0 :expr '(meter 7 8)) (new cmn :time 0 :expr 'cs-major) (new cmn :time 0 :note 'c4 :duration (rhythm 'h..) :data '(pppp)) (new cmn :time 3.5 :note 'df5 :duration (rhythm 'e) :data '(accent sfz)) (new cmn :time 4 :note 'f4 :duration 2 :data '(mp fermata)))) ;;; generate an .eps file (events #&sevens "sevens.eps") ;;; generate a .cmn input file (events #&sevens "sevens.cmn" :size 20) ;;; generate a .mid file (events #&sevens "sevens.mid")
(midi-file-print "sevens.mid") File: sevens.mid Format: 0 Tracks: 1 Division: 480 Track 0, length 52 0 #<Tempo Change 1000 ms> 0 #<Time Signature 7/8 (24 clocks, 8 32nds)> 0 #<Key Signature 7 sharps, major> 0 #<Note-On 0 60 64> 1680 #<Note-Off 0 60 127> 0 #<Note-On 0 73 64> 240 #<Note-Off 0 73 127> 0 #<Note-On 0 65 64> 960 #<Note-Off 0 65 127> "seven.mid"
Example 3. Generate random metered measures in customized staffs.
(define (ranmeas meas maxstaff low hi) (process with cnt = 0 and bea and mea = (new heap :of '( 7 3 5 4)) and num = 1 ;; start new measure... if (= cnt 0) set bea = (next mea) and set cnt = bea and set num = (+ num 1) and output (new cmn :time (now) :expr `(meter ,bea 8)) ;; always output note, 50% are accented output (new cmn :time (now) :note (between low hi) :staff (random maxstaff) :duration 1/2 :data (odds .5 '(accent))) set cnt = (- cnt 1) until (and (= cnt 0) (= num meas)) wait 1/2)) ;; output a single staff (events (ranmeas 15 1 60 80) "test.eps" :size 20) ;;; define custom staff descriptions for the cmn score. (define ins '((0 :name "Bb Cl." :clef :treble) (1 :name "Viola" :clef :alto))) ;;; insure staffing, title and font size for score. (io "duet.eps" :staffing ins :size 20 :title "Etude for Two") (events (ranmeas 15 2 50 80) "duet.eps")
cmn-file [Class]