Fwd: [CM] a FOMUS problem

Rick Taube taube@uiuc.edu
Sat, 1 Apr 2006 22:50:57 -0600


Here are 2 polyphonic Fomus examples. unfortunatly the ring modulation 
one triggers a fomus array index error that didnt happen last fall. the 
midi file from it seems to be ok.

--------
(in-package cm)
(use-system :fomus)

;;;
;;; 5-voice Harmonics "Etude"
;;;

(defun play-harmonics (note beat harm1 harm2)
   (process for h from harm1 to harm2
            for f = (* (hertz note) h)
            output (new note :off (now) :dur (rhythm beat)
                        :note (keynum f :hz) :partid harm1)
            wait (rhythm beat)))

(defparameter primes '(2 3 5 7 11))

(defparameter cellos (loop for p in primes
                            collect (new part :partid p :instr :cello)))

(events (process for p in primes
                  sprout (play-harmonics 'c1 (/ 1 p) p (* p 4)))
         "primes.ly" :quartertones t :max-tuplet 11
         :parts (reverse cellos) :view t)

(events (process for p in primes
                  sprout (play-harmonics 'c1 (/ 1 p) p (* p 4)))
         "primes.mid" :channel-tuning 8 :tempo 40)

;;;
;;; Ring Modulation Etude
;;;

(defun random-rm (num notes)
   (process with pat = (new heap :of notes
                            :for (new weighting :of '(1 2 3)))
            repeat num
            for set1 = (next pat t)
            for set2 = (next pat t)
            for set3 = (rm-spectrum set1 set2 :spectrum ':note
                                    :remove-duplicates t)
            for reps = (pick 3 4 5)
            sprout (process with pat = (new cycle :of (list set1 set2)
                                            :repeat reps)
                            for c = (next pat)
                            until (eod? c)
                            each k in c output (new midi :time (now)
                                                    :keynum k
                                                    :channel 0
                                                    :duration .25
                                                    :amplitude .2)
                            wait .25)
            sprout (process with pat = (new cycle :of set3)
                            repeat (* 2 reps)
                            output (new midi :time (now)
                                        :keynum (next pat)
                                        :channel 1
                                        :duration .125
                                        :amplitude .4)
                            wait .25)
            wait (* .25 reps 2)))

(defparameter duo (list (new part :partid 0 :instr ':viola)
                         (new part :partid 1 :instr ':piano)))

(defparameter mus (new seq))

(events (random-rm 16 (loop for i from 60 to 72 collect i)) mus)

(events mus "rm-etude.mid" :tempo 80)

(events mus "rm-etude.ly" :parts duo :view t)


Array index -1 out of bounds for #(",,," ",," "," "" "'" "''" "'''" 
"''''"
                                    "'''''") .
    [Condition of type SIMPLE-ERROR]

Restarts:
   0: [ABORT-REQUEST] Abort handling SLIME request.
   1: [ABORT-BREAK] Reset this process
   2: [ABORT] Kill this process

Backtrace:
   0: (FOMUS::LYNOTE 11 0 0 'NIL 'NIL)
   1: (FOMUS::SAVE-LILYPOND '(#1=#Z(FOMUS:PARTEX :ID NIL :PARTID 1 :NAME 
NIL :ABBREV NIL :INSTR ...) #1#(FOMUS:PARTEX :ID NIL :PARTID 0 :NAME 
NIL :ABBREV NIL :INSTR ...)) "% LilyPond score file
% FOMUS v0.1.54