[CM] mixing cmn and midi data in cm-2.7?

bill sack wsack@buffalo.edu
Tue, 03 Jan 2006 11:38:59 -0500


hello and happy 2006!
way back in cm-2.4 days i could output cmn data in parallel with midi 
output and it would get passed along when the events were output to a 
cmn file - e.g. adding dynamic marks at significant amplitude changes 
like this:
...
(output (new midi start (+ ahead (now)) keynum tone
             duration riv amplitude amp channel ch))
         (when (not (eq dyn old-dyn))
           (output (new cmn time (now) channel ch
                data (list dyn))))
...
['dyn' being a dynamic marking ('ff, 'mp, etc.) determined through a 
(amp->dyn) lookup function]

when i tried something similar in cm-2.7:
...
output (new midi :time (now)
                           :keynum (nth p notes)
                           :duration rhy
                           :amplitude (max amp 0)
                           :channel stf)
               if (not (eq dyn old-dyn))
               sprout (new cmn :time (now)
                           :staff stf
                           :data `(,dyn))
...
trying to output this to a cmn file throws this error (in cmucl-19c, of 
course):
No matching method for the generic function
#<STANDARD-GENERIC-FUNCTION CMN::ODB-ONSET (2) {58F361B1}>, when called with
arguments (#<CMN::SCORE-OBJECT-LIST {58393395}>).
   [Condition of type PCL::NO-APPLICABLE-METHOD-ERROR]

Restarts:
  0: [CONTINUE] Retry call to :FUNCTION.
  1: [ABORT   ] Return to Top-Level.

Debug  (type H for help)

("DEFMETHOD NO-APPLICABLE-METHOD (T)" #<unused-arg> #<unused-arg>
 #<STANDARD-GENERIC-FUNCTION CMN::ODB-ONSET (2) {58F361B1}>
 (#<CMN::SCORE-OBJECT-LIST {58393395}>))

if i change the (new cmn ... so it has a :note and a :duration there's 
no error, but the output contains two notes (the midi and the cmn) every 
time the condition is met.

surely there's a more elegant and general way to do this? i'd rather not 
have to change the output function of my algorithm depending upon 
whether i want to see something (.cmn) or hear it (midi).

thanks in advance for all help.

bill