EDIT: add-auxiliary-notes

Hi Mike,

I’m loving add-auxiliary-notes but it plays havoc with handle-ties when used in conjunction with any of the tie-over-rests, etc. methods.

I’ve added an extra line to the add-auxiliary-notes-aux function which makes everything work nicely. Could this be incorporated into the download, please?

(defun add-auxiliary-notes-aux (pitch-list &key (num-notes 3) (interval 1)
                                             ignore (activity-level 5)
                                             destructively verbose)
  (let* ((igns (loop for p in (force-list ignore) collect
                    (frequency (make-pitch p))))
         (most-used (hash-least-useds (pitch-list-stats pitch-list)
                                      :ignore igns :num num-notes
                                      :auto-inc nil :invert t))
         (result '())
         (als (loop repeat num-notes collect (make-al 2))))
    (loop for thing in pitch-list
       for freq = (get-freq thing)
       for pos = (position freq most-used)
       do
         (push (if (and (atom freq)     ; don't fiddle with chords
                        pos
                        (active (nth pos als) activity-level))
		   ;; DJR - Mon Jun 27 18:34:35 BST 2016
		   ;; The following line stops the function from
		   ;; disrupting handle-ties
		   (unless (or (is-tied-to thing)(is-tied-from thing))
		     (if (event-p thing)
			 (prog2
			     (when verbose
			       (format t "~&At bar ~a, transposing ~a "
				       (bar-num thing) (get-pitch-symbol thing)))
			     (transpose thing interval
					:destructively destructively)
			   (when verbose
			     (format t "to ~a" (get-pitch-symbol thing))))
			 (transpose thing interval)))
                   thing)
               result))
    (nreverse result)))

One thought on “EDIT: add-auxiliary-notes”

  1. Well spotted Dan. Thanks for this. I’d do your is-tied-* tests after the (event-p ) test because otherwise those methods might fail. But I’ve added this very sane code to the repo now:

                       (if (and (event-p thing)
                                ;; thanks to Dan Ross for this; a further
                                ;; improvement might be to change the tied notes if
                                ;; this is tied-from but hey ho...
                                (not (is-tied-to thing))
                                (not (is-tied-from thing)))
    

Leave a Reply

Your email address will not be published. Required fields are marked *