[CM] CMN::INSERT-BARS-TIES-AND-RESTS problem
Rodrigo Segnini
rsegnini at ccrma.Stanford.EDU
Thu Aug 28 19:56:58 PDT 2003
Hi Bill, list colleagues.
(long explanation follows)
I am creating cmn scores out of note-lists obtained from clm.
The function display-notes handles that, so I embedded it on a new
function called cmn-parser, as follows:
(defun cmn-parser (note-lists &key (title "score title")(meter '(2 4)))
(cmn::cmn-store
(clm::display-notes (list (cmn::size 12) ; modified display-notes
(cmn::all-output-in-one-file t)
(cmn::automatic-page-numbers t)
(cmn::automatic-measure-numbers t)
(cmn::redundant-accidentals nil)
(cmn::title-separation 5)
(cmn::title title))
note-lists (first meter) (second meter))) t)
You would note I had to modify the original cmn::display-notes because I
wanted to be able to change the meter on the fly.
(defun clm::display-notes (args notes numerator denominator)
(let ((new-score (cmn::init-clm-input)))
(loop for arg in args do
(if (cmn::self-acting-p arg)
(funcall (cmn::action arg) new-score (cmn::argument arg))))
(loop for note in notes do (apply #'clm::add-note new-score
(cmn::make-name-a-string (first note))
(cdr note)))
(cmn::finish-clm-input new-score nil nil
`(set-meter "hi" ; last minute metric add
(cmn::meter ,numerator ,denominator)))
))
You will also need the following two functions:
(defun set-meter (staff meter)
(loop for stf in cmn::staff-descriptors do
(setf (cmn::staff-data (cmn::stfdat-staff stf))
(append (cmn::staff-data (cmn::stfdat-staff stf))
(list (eval meter))))))
; for the above function to work, cmn::add-note is modified
(defun clm::add-note (score name begin-time duration frequency &rest
rest)
(apply #'cmn::add-note-to-staff score
(cmn::find-staff score name) begin-time duration frequency rest)
;(first rest))
(format t "~s ~d ~d ~d ~d ~d ~%" ; debug what's passed to
add-note-to-staff
score name begin-time duration frequency rest);(first rest))
)
My problem is that for note-lists of a certain length, I get the
following error:
Error: `:BAR' is not of the expected type `NUMBER'
[condition type: TYPE-ERROR]
Zooming on the stack I can track the last working process to be fillify
(cmn4.lisp):
Evaluation stack:
(ERROR TYPE-ERROR :DATUM ...)
->(CMN::INSERT-BARS-TIES-AND-RESTS #<CMN::SCORE @ #x22540592>
#<CMN::STAFF @ #x22576d52> ...)
((:INTERNAL CMN::FILLIFY 4) #<CMN::SCORE @ #x22540592>
#<CMN::STAFF @ #x22576d52>)
(CMN::MAP-OVER-STAVES #<Closure # @ #x2257f1d2> #<CMN::SCORE @
#x22540592>)
(CMN::FILLIFY #<CMN::SCORE @ #x22540592>)
(CMN::CMN #<CMN::SCORE @ #x22540592>)
(CMN::FINISH-CLM-INPUT #<CMN::SCORE @ #x22540592> NIL ...)
(LET (#) (LOOP FOR ARG ...) ...)
(DISPLAY-NOTES (# # # ...) (# # # ...) ...)
... more older frames ...
It crashes trying to insert a new bar. Using the following note-lists
(length: 74 notes) you can reproduce the error.
(("fl" 0.0d0 1/5 261.62555 0) ("bsn" 0.2d0 1/5 61.735447 0)
("ob" 0.2d0 1/5 246.94179 0) ("bsn" 0.4d0 1/5 61.735447 0)
("ob" 0.4d0 1/5 246.94179 0) ("bsn" 0.6d0 1/5 61.735447 0)
("ob" 0.6d0 1/5 246.94179 0) ("bsn" 0.8d0 1/5 61.735447 0)
("ob" 0.8d0 1/5 246.94179 0) ("bsn" 1.0d0 1/5 61.735447 0)
("ob" 1.0d0 1/5 246.94179 0) ("bsn" 1.2d0 1/5 61.735447 0)
("fl" 1.2d0 1/5 261.62555 0) ("bsn" 1.4d0 1/5 61.735447 0)
("fl" 1.4d0 1/5 261.62555 0) ("bsn" 1.6d0 1/5 61.735447 0)
("fl" 1.6d0 1/5 261.62555 0) ("bsn" 1.8d0 1/5 61.735447 0)
("fl" 1.8d0 1/5 261.62555 0) ("bsn" 2.0d0 1/5 61.735447 0)
("fl" 2.0d0 1/5 261.62555 0) ("fl" 2.2d0 1/5 2093.0044 0)
("bsn" 2.2d0 1/5 349.2283 0) ("fl" 2.4d0 1/5 2093.0044 0)
("bsn" 2.4d0 1/5 349.2283 0) ("bsn" 2.6d0 1/5 61.735447 0)
("fl" 2.6d0 1/5 261.62555 0) ("fl" 2.8d0 1/5 2093.0044 0)
("bsn" 2.8d0 1/5 349.2283 0) ("fl" 3.0d0 1/5 2093.0044 0)
("bsn" 3.0d0 1/5 349.2283 0) ("bsn" 3.2d0 1/5 61.735447 0)
("fl" 3.2d0 1/5 261.62555 0) ("fl" 3.4d0 1/5 2093.0044 0)
("bsn" 3.4d0 1/5 349.2283 0) ("bsn" 3.6d0 1/5 61.735447 0)
("fl" 3.6d0 1/5 261.62555 0) ("bsn" 3.8d0 1/5 61.735447 0)
("fl" 3.8d0 1/5 261.62555 0) ("bsn" 4.0d0 1/5 61.735447 0)
("fl" 4.0d0 1/5 261.62555 0) ("bsn" 4.2d0 1/5 61.735447 0)
("fl" 4.2d0 1/5 261.62555 0) ("bsn" 4.4d0 1/5 61.735447 0)
("fl" 4.4d0 1/5 261.62555 0) ("bsn" 4.6d0 1/5 61.735447 0)
("fl" 4.6d0 1/5 261.62555 0) ("bsn" 4.8d0 1/5 61.735447 0)
("fl" 4.8d0 1/5 261.62555 0) ("bsn" 5.0d0 1/5 61.735447 0)
("fl" 5.0d0 1/5 261.62555 0) ("tuba" 5.2d0 1/5 65.40639 0)
("tuba" 5.4d0 1/5 65.40639 0) ("tuba" 5.6d0 1/5 65.40639 0)
("tuba" 5.8d0 1/5 65.40639 0) ("tuba" 6.0d0 1/5 65.40639 0)
("tuba" 6.2d0 1/5 65.40639 0) ("tuba" 6.4d0 1/5 65.40639 0)
("tuba" 6.6d0 1/5 369.9945 0) ("tuba" 6.8d0 1/5 369.9945 0)
("tuba" 7.0d0 1/5 369.9945 0) ("tuba" 7.2d0 1/5 369.9945 0)
("tuba" 7.4d0 1/5 369.9945 0) ("tuba" 7.6d0 1/5 65.40639 0)
("tuba" 7.8d0 1/5 65.40639 0) ("tuba" 8.0d0 1/5 65.40639 0)
("tuba" 8.2d0 1/5 369.9945 0) ("tuba" 8.4d0 1/5 369.9945 0)
("tuba" 8.6d0 1/5 369.9945 0) ("tuba" 8.8d0 1/5 65.40639 0)
("tuba" 9.0d0 1/5 65.40639 0) ("tuba" 9.2d0 1/5 65.40639 0)
("tuba" 9.4d0 1/5 65.40639 0) ("tuba" 9.6d0 1/5 65.40639 0)
If you use a subset of the above up to the 66th note (around the fourth
measure), there are no errors, i.e.:
[1](cmn-parser (subseq note-lists 0 66)) <- OK
[2](cmn-parser (subseq note-lists 66 74)) <- also OK
but trying to parse the whole (cmn-parser note-lists) or even
(cmn-parser (subseq note-lists 61 67)), fail.
Any help is greatly appreciated.
Rodrigo
p.s.:
sp0-66.eps shows the result of [1] and sp66-74.eps of [2]
--
Rodrigo Segnini <rsegnini at ccrma.stanford.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sp0-66.eps
Type: application/postscript
Size: 43866 bytes
Desc: not available
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20030828/24ee264d/attachment.eps>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sp66-74.eps
Type: application/postscript
Size: 13682 bytes
Desc: not available
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20030828/24ee264d/attachment-0001.eps>
More information about the Cmdist
mailing list