Jump to content

Recommended Posts

Hi,

 

here's a function i've made for my own usage and i think could be useful for others.

It is a split point function which divide an OMN flux according to a list of split points.

 

Attached, you will find the French doc of the function 😉

;;; SPLIT-POINT
;;; SB. 2020
;;; Fonction utile pour séparer les 2 mains pour une partie de piano
;;; renvoie une liste de listes


(defun split-point (split-points omn-seq)
  (do-verbose ("split-point")
  (let* (
         (spltconvert (if (numberp (car split-points))
                        split-points
                        (pitch-to-integer split-points)))
         (spltp (gen-trim (length omn-seq) spltconvert))
         (p1 (loop for sp in spltp
               for l in omn-seq
               collect (ambitus-filter `(,sp 128) l)
               ))
         (p2 (loop for sp in spltp
               for l in omn-seq
               collect (ambitus-filter `(-128 ,(- sp  1)) l)
               ))
         )
    (list p1 p2))))

#|
(split-point '(c4 d4) '((e a3d4 c4e4 f4c5 q g3d4 e4)(e a3d4 c4e4 f4c5 q g3d4 e4)))
=> (((e d4 c4e4 f4c5 q d4 e4)(q d4 e4 f4c5 d4 e4)) ((e a3 - - q g3 -)(e a3 c4 - q g3 -)))


;;; Example
(setf pmat (make-scale 'c2 32 :alt '(2 1 2 3)))
(setf pch (rnd-sample 128 pmat))
(setf chrd (chordize-list (gen-divide (rnd-number 8 1 4) pch)))
(setf mat (length-legato (gen-filter-euclidean 8 16 4 16 chrd 's '(mf))))
(setf split (split-point '(c4) mat))
(setf piano-rh (ambitus-chord 12 (first split)))
(setf piano-lh (ambitus-chord 12 (second split)))

(ps 'gm
    :p (list piano-rh piano-lh)
    )


|#

 

SB.

split-point.rtfd.zip

Link to comment
Share on other sites

  • 2 years later...

Hi, I have been trying to use this split function which I find very handy. But, in particular with this chord sequence, it fails:

 

(setf mat '((h g2f3f4d5 -) (h a2g3g4e5 -) (q b2a3a4f5 c3b3b4g5 d3cs4c5gs5 eb3d4d5a5) (q e3eb4eb5bb5 f3e4e5b5 f3f4f5c6 f3f4f5c6) (q f3f4f5c6 e3e4f5c6 eb3e4e5c6 d3d4eb5b5) (h cs3cs4d5bb5 b2b3c5a5) (h a2a3b4gs5 gs2g3a4g5) (q fs2f3g4f5 -h.) (q e2eb3f4e5 d2cs3eb4d5 cs2b2cs4cs5 c2bb2b3c5) (h b1gs2bb3bb4 -) (-w) (-w) (-h q. bb1g2gs3a4 e a1fs2g3gs4) (q a1f2fs3g4 a1f2f3fs4 bb1f2f3f4 bb1fs2f3f4) (q b1fs2f3f4 cs2g2fs3f4 d2a2g3f4 e2bb2gs3fs4) (h fs2c3a3g4 -) (-w) (-w) (-h q. g2d3b3gs4 e a2e3cs4a4) (q b2fs3eb4bb4 c3gs3f4c5 d3bb3g4cs5 eb3c4a4eb5) (h e3d4b4e5 -) (h f3eb4c5f5 -) (h f3e4d5g5 q. f3f4eb5gs5 e f3f4e5a5) (q e3f4f5bb5 -h.) (-w) (-w) (-h q. eb3f4f5b5 e d3e4f5c6) (q c3eb4f5c6 b2cs4e5c6 a2c4eb5c6 g2bb3d5c6) (q fs2gs3cs5b5 e2fs3b4bb5 d2e3a4a5 cs2d3g4gs5) (q b1c3f4g5 bb1bb2eb4f5 bb1a2cs4e5 a1g2c4d5) (h a1fs2bb3cs5 a1f2gs3c5) (h bb1f2g3bb4 -q b1f2fs3a4) (q c2f2f3gs4 cs2fs2f3g4 eb2g2f3fs4 e2gs2f3f4) (q fs2bb2fs3f4 gs2c3g3f4 bb2cs3gs3f4 b2eb3a3f4) (h cs3fs3b3fs4 d3gs3cs4g4) (q eb3bb3eb4gs4 e3b3f4a4 f3cs4g4bb4 f3d4a4c5) (w f3e4bb4cs5) (e f3e4c5eb5 e3f4d5e5 eb3f4eb5f5 d3f4e5g5 c3e4f5gs5 bb2eb4f5a5 a2d4f5bb5 g2cs4f5b5) (q f2b3e5c6 eb2a3eb5c6 d2g3d5c6 c2f3cs5c6) (h b1eb3b4c6 -) (-w) (-h q bb1cs3a4b5 a1b2g4bb5) (w a1a2f4a5) (h a1gs2eb4gs5)))

 

(split-point '(c4) mat)

 

I get the message "Error: The value nil is not of the expected type number."

 

I can't find the problem here. 

Thanks!

Link to comment
Share on other sites

This will fix if length-rest list:

 

(defun split-point (split-points omn-seq)
  (do-verbose ("split-point")
  (let* (
         (spltconvert (if (numberp (car split-points))
                        split-points
                        (pitch-to-integer split-points)))
         (spltp (gen-trim (length omn-seq) spltconvert))
         (p1 (loop for sp in spltp
               for l in omn-seq
               collect (if (length-restsp l) l (ambitus-filter `(,sp 128) l))
               ))
         (p2 (loop for sp in spltp
               for l in omn-seq
               collect (if (length-restsp l) l (ambitus-filter `(-128 ,(- sp  1)) l))
               ))
         )
    (list p1 p2))))
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