Jump to content

Featured Replies

Posted

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.

an other solution... same result...

greetings

andré

;;; by using SINGLE-EVENTS ->  my preferred tool

(defun alt-add-3rd-quarter (omn-list)
  (loop for i in (single-events omn-list)
    when (equal (first i) 'q)
    append (omn-replace :pitch (chord-interval-add '(4) (list (second i))) i)
    else append i))
  

(alt-add-3rd-quarter '(e c4 p d4 q e4 f stacc e f4 p a4 q g4 f stacc))
=> (e c4 p e d4 p q e4gs4 f stacc e f4 p e a4 p q g4b4 f stacc)

 

my wish for SINGLE-EVENTS would be to add user-defined "informations" to an event -> like voice-number, oder instrument, or....

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy