Jump to content

Recommended Posts

Hi,

 

here's a small function i did for one of my work in progress.

 

The idea is to process omn pitch material relating to omn length values.

 

For example, if omn length value faster than 1/8, "monodize" the melody at this point.

 

;;; ===============================================================
;;; MONO-FAST
;;; "Monodize" (remove chords) the omn parts faster than the given rhythmic value. 
;; Utility function
(defun mono-fast* (max-length-value mat)
  (let* (; disassembling the omn mat into his components
         (omn-mat (disassemble-omn mat))
         (p-mat (getf omn-mat :pitch))
         (l-mat (getf omn-mat :length))
         (v-mat (getf omn-mat :velocity))
         (a-mat (getf omn-mat :articulation))
         ; empty list for the result of pitch processing
         (re-pmat '())
         )
    (loop
      for i from 0 to (-(length p-mat)1)
      do (if (< (nth i l-mat) max-length-value)
           (push (pitch-demix 1 (list (nth i p-mat))) re-pmat)
           (push (nth i p-mat) re-pmat)
           )
      )
    ; re-assembling the omn material
    (make-omn
     :pitch (reverse (flatten re-pmat))
     :length l-mat
     :velocity v-mat
     :articulation a-mat
     )))

;; Main function
(defun mono-fast (max-length-value mat)
  (if (listp (car mat))
    (mapcar (lambda(x) (mono-fast* max-length-value x)) mat)
    (mono-fast* max-length-value mat)))

(setf test-seq '(q c4e4 p d4f4 e4g4 s f4a4 g4b4 a4c5 b4d5 q c5e5))
(setf test-seq2 '((q c4e4 p d4f4 e4g4) (s f4a4 g4b4 a4c5 b4d5 q c5e5)))

(mono-fast '1/8 test-seq)
(mono-fast '1/8 test-seq2)

SB.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy