- [Class]
cmn-stream
Implements CMN manuscript output to .eps files and .cmn source files. This class is automatically chosen when you specify a file with a .eps or .cmn extension to the events function.
cmn-stream
supports the following slot
initializations:
:exact
boolean- If true and all time values in the score are expressed as rational numbers (integer or ratio) then CMN's time-line parsing avoids rhythmic quantization problems caused by floating point round-off errors.
:staffing
list-
A list of staff descriptions defining the attributes of the CMN
manuscript staffs. Objects in the score set their staff by specifying
the appropriate staff id (for example by using the
:channel
value of a midi object or the:staff
value of a cmn object.) Each staff description in list is a list in the format:(id [:name string] [:clef symbol] [:meter list])
:name
is a string name for the staff and defaults to "staff-n" where n is the staff id. The value of:clef
is a keyword clef name::treble
,:bass
,:alto
, etc., or a list of clef names. If a clef not specified then CMN will choose whatever clef(s) it thinks best as it manuscripts the objects in the score. If the clef is:both
then you get a grand staff. If the value is a list it these choices will limit CMN's clef choices to that list. The value of:meter
is a meter list for the staff like (3 4), (7 8) and so on. See below for an example of a staffing list.
:size
integer- The overall (font) size of the score. Defaults to 40.
-
:title
string - The title of the score printed at top of page.
:metronome
integer- The tempo for parsing the time-line of score objects.
Consult the CMN manual for more information.
Examples:
Example 1. Outputting to CMN scores.
(define (testit stf len nts) ;; midi channel numbers map to staves. (let ((nts (new heap :notes nts)) (rhy (new random :of (list 1 (new cycle :of '(1/2 1/2)))))) (process while (< (now) len) for n = (next nts) for r = (next rhy) output (new midi :time (now) :duration r :keynum n :channel stf) wait r))) ;;; define staff descriptions (define staffs '((0 :name "Viola" :clef :alto :meter (4 4)) (2 :name "Flute" :clef :treble :meter (4 4)))) ;;; generate an .eps file (events (list (testit 0 12 '(c3 d ef f g)) (testit 1 12 '(c5 d ef f g))) "testit.eps" :staffing staffs :size 24 :exact true :title "Hiho!") ;;; another way to set score properties (io "duet.cmn" :staffing staffs :size 20 :exact true :title "Duet") ;;; generate a .cmn file (events (list (testit 0 12 '(c3 d ef f g)) (testit 1 12 '(c5 d ef f g))) "duet.cmn")