Jump to content

Featured Replies

Posted

take it as a sketch... you can see the input/output

greetings andré

 

p.s. could be nice, if we combine it with a/the/my overwrite-function

p.s.s an overwrite-function could be very very smart for work... think: for example: you have coded some music but you would overwrite the last two quaternotes of bar  5 in the violin.... !?

 

 

;;; ------------------------------------------------------------------------
;;; INSERTING ON BAR/BEAT
;;; ------------------------------------------------------------------------



(defun inserting-on-bar/beat (insert &key time-sign bar beat)
  (let ((extra-rest (* -1 (/ (- (car beat) 1) (cadr beat))))
        (basic-time-sign time-sign)
        (time-sign (if (listp (car time-sign))
                          (loop for i in time-sign
                            when (> (caddr i) 1)
                            append (loop repeat (caddr i)
                                     collect (list (car i) (cadr i)))
                            else collect (list (car i) (cadr i)))
                          (append time-sign))))
                          
  (omn-to-time-signature
   (length-rest-merge
    (flatten 
     (append (if (> bar 1)
               (list (if (listp (car time-sign))
                       (loop repeat (- bar 1)
                         for i in time-sign
                         collect (* -1 (/ (car i) (cadr i))))
                       (* -1 (1- bar) (/ (car time-sign) (cadr time-sign))))))
             (length-rational-quantize 
              (if (/= 0 extra-rest)
                (append (list extra-rest) insert)
                insert)
              :round  (if (listp (car time-sign))
                        (/ (car (nth bar time-sign)) (cadr (nth bar time-sign)))
                        (/ (car time-sign) (cadr time-sign)))))))
   basic-time-sign)))





;;; ------------------------------------------------------------------------
;;; INSERTING ON BAR/BEAT
;;; ------------------------------------------------------------------------

(inserting-on-bar/beat '(s c4 d4 e4 f4 pp) 
                         :time-sign '(4 4)
                         :bar 2
                         :beat '(3 16))

(inserting-on-bar/beat '(5q c4 d4 e4 f4 pp) 
                         :time-sign '(4 4)
                         :bar 2
                         :beat '(2 20))

(inserting-on-bar/beat '(3q c4 d4 e4 f4 pp) 
                         :time-sign '(4 4)
                         :bar 1
                         :beat '(5 12))

  
(inserting-on-bar/beat '(s c4 d4 e4 f4 pp) 
                         :time-sign '((2 4 1) (3 8 1) (5 8 1) (3 4 1))
                         :bar 3
                         :beat '(3 16))

 

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