Stephane Boussuge Posted March 19, 2017 Share Posted March 19, 2017 Hi, Here is a short example of OMN deconstruction/reconstruction technique useful when you want to do functions for working directly with omn. ;; Example of function application based on binary-list. (flatten (do-section '(0 1 0) '(chord-interval-add '(4) x) (mclist '(c4 d4 e4)))) ;;; Function example to search for '1/4 length and process the corresponding ;;; pitch for add Major 3rd interval when '1/4 is found. ;;; It is also a good example of deconstruction/reconstruction of OMN ;;; inside a function (defun add-3rd-quarter (omn) (let ((plist (disassemble-omn omn))) (setf (getf plist :pitch) (flatten (do-section (binary-invert (gen-binary-remove '1/4 (getf plist :length))) '(chord-interval-add '(4) x) (mclist (getf plist :pitch))))) (apply 'make-omn plist))) (add-3rd-quarter '(e c4 p d4 q e4 f stacc e f4 p a4 q g4 f stacc)) => (e c4 p d4 q e4gs4 f stacc e f4 p a4 q g4b4 f stacc) SB. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.