Jump to content

Featured Replies

Posted

i didn't find a OM-library-solution for this kind of thing, so i coded it...

 

if you want to REPLACE the articulation of some specific pitches. perhaps all 'd4 sould be PONTE... you could use this.

it was necessary to code it like that, because otherwise you get in trouble with the empty parameter-slots...

 

should work fine

greetings

andré

 

;;; SUBFUNCTIONS

(defun eliminate-nil (alist)
  (loop for i in alist
    when (not (null i))
    collect i))

(defun complete-event-slots (omn-list)
  (let ((omn-art (omn :articulation (single-events (flatten omn-list)))))
    (single-events 
     (omn-replace :articulation (flatten 
                                 (eliminate-nil (loop for i in omn-art
                                                  for cnt = 0 then (incf cnt)
                                                  when (equal (car i) '-)
                                                  collect (nth (1- cnt) omn-art)
                                                  else collect i)))
                omn-list))))

;(complete-event-slots '(5q a4 ff pizz 5q e3 -e 5q a4 f))


;;; MAIN FUNCTION

(defun replace-articulation-of-a-pitch (omn-list &key pitches articulation (chance 1.0))
  (loop for i in (complete-event-slots (flatten omn-list))
    when (and (member (car (omn :pitch i)) pitches)
              (prob? chance))
    append (omn-component-replace i (list articulation))
    else append i))





;;; EXAMPLE
(replace-articulation-of-a-pitch '(5q a4 ff pizz 5q e3 p -q 5q d4 pizz)
                                 :pitches '(a4 d4) 
                                 :articulation 'ponte
                                 :chance 1.0)

-> (5q a4 ff ponte 5q e3 p pizz -q 5q d4 p ponte)

 

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