Jump to content
Sign in to follow this  
AM

add tuning float to single-events?

Recommended Posts

dear janusz

 

is there an OPMO-solution to put the FLOAT for tuning in every event (with pitch) . some times ago i coded such an "add-data-to-event"-function for my own, but a OPMO-one would be more professional 🙂

 

greetings

andré

Share this post


Link to post
Share on other sites

Check the GET-RUNNING function. This will explain as well how to use floats in tuning.

Share this post


Link to post
Share on other sites

i need something like this 

((t b4 mp nr0 0.3) (-he.) (-whe..) (s. eb4 ppp nr3 0.5) (s g4 pp nr4 0) (t fs3 fff mute 0.3) (s. gs4 ppp nr6 0) (-e..))

so it's possible keep the overview which PITCH is TUNED and which is not... this way i can make precise assignments.

for example: i code a score with no microtonal structures, but afterwards i want to INSERT/OVERWRITE some pitches/liitle sections with microtonal... 

so the EVENT-thing seems better for me to keep the overview/control, then to have ALWAYS a seperate list. so i will write TUNING-float into  EVENTS, and a function GENERATES afterwards the correct LIST for tuning.

 

i will post the FUNCTIONS later..

 

Share this post


Link to post
Share on other sites

No, you can't do that. The float is reserved for velocity.

Share this post


Link to post
Share on other sites

let me try (and fail perhaps), but thanx for the hint!

Share this post


Link to post
Share on other sites

here is a solution - on attributes-level. next step will be to do/code it with "JOINED-attributes"... 

thanxs for tests and hints! 🙂

 



;;; -------------------------------------------------------------------------------------------------------------------
;;; -------------------------------------------------------------------------------------------------------------------
;;; -------------------------------------------------------------------------------------------------------------------
;;; this function adds CENTS or FLOATS to text-attributes, in this way you can notate 
;;; - have a look how ii's written in the score
;;; 

(defun add-cents-tuning-to-text-atrributes (&key (centlist nil) (type nil))
  (loop for i in (loop for x in (if (null centlist)
                                  (append (loop for i from 1 upto 99 collect i) (loop for i from 1 upto 99 collect (neg! i)))
                                  centlist)
                   collect (compress (list x 'ct)))
    append (add-text-attributes (list i (write-to-string (if (equal type :float) 
                                                           (float (/ (append (compress (if (equal (car (explode i)) '-)
                                                                                         (if (= (length (explode i)) 5)
                                                                                           (filter-first 3 (explode i))
                                                                                           (filter-first 2 (explode i)))
                                                                                         (if (= (length (explode i)) 4)
                                                                                           (filter-first 2 (explode i))
                                                                                           (filter-first 1 (explode i)))
                                                                                         ))) 100))
                                                           i))))))


;;; EXAMPLES

(add-cents-tuning-to-text-atrributes :type :float)
;; have a look to notation: cmd3
(-q -q  e c4 fff q c4 mf 50ct e c4 mf -40ct e c5 ff)


(add-cents-tuning-to-text-atrributes :type :cents) ;; cents are written
;; have a look to notation: cmd3
(-q -q  e c4 fff q c4 mf 50ct e c4 mf -40ct e c5 ff)


;;; -------------------------------------------------------------------------------------------------------------------
;;; -------------------------------------------------------------------------------------------------------------------
;;; -------------------------------------------------------------------------------------------------------------------
;;; this function get out all notated microtones for TUNING ;;; if there is nothing written it will be 0 cents (0)

(defun memberp (n liste)
  (not (equal 'nil (member n liste))))

(defun get-tuning-from-events (omnlist centlist)
  (loop for i in (single-events (length-rest-remove omnlist))
    when (memberp (car (last i)) centlist)
    do (setf n  (float (/ (append (compress (remove-if-not #'numberp (explode (car (last i)))))) 100)))
    and collect (if (equal (car (explode (car (last i)))) '-)
                  (* -1 n)
                  n)
    else collect 0))


(setf centlist (add-cents-tuning-to-text-atrributes :type :float))

;;; evaluate this and you will get the tuning-list
(get-tuning-from-events '(-q -q  e c4 fff q c4 mf 50ct e c4 mf -40ct e c5 ff) centlist)
=> (0 0.5 -0.4 0)  


 

Share this post


Link to post
Share on other sites

> Check the GET-RUNNING function. This will explain as well how to use floats in tuning.

 
Is that a new function? It is not available in my image.
 
Best,
Torsten

 

--------------------------

Unfortunately, evaluating add-cents-tuning-to-text-atrributes results in an error for me. 

 

> Error: ((= (length (explode i)) 5) (filter-first 3 (explode i))  (filter-first 2 (explode i))) can't be destructured against the lambda list (ccl::test true &optional false), because it contains 4 elements, and at most 3 are expected.
> While executing: (:internal ccl::nx1-compile-lambda), in process Listener-2(9).

Share this post


Link to post
Share on other sites

dear torsten, i get no ERROR!? but here would be the newer/complete version..

 

 

p.s. i think it should be GET-TUNING and not GET-RUNING 🙂

 

Share this post


Link to post
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.

Sign in to follow this  

  • Similar Topics

    • By AM
      with these functions you could write your CENTS for tuning directly into OMN-attributes, and extract it afterwards
       
      1. generate by add-cents-tuning-to-text-atrributes the cent values into text-attributes (only one time), you could decide if it will be shown in the score "as CENTS or as FLOAT"
      2. now you could write your CENTS for tuning into OMN-attributes like 50ct, -34ct ...also in combination with other text-attributes legno+50ct, pizz+-65ct, -45ct+batt
      3. you could EXTRACT afterwards your LIST for TUNING directly from OMN by   get-tuning-from-omn*.if an EVENT has no cent-attribute it will be unchangend (= 0 cents)
       
       
      ;;; ------------------------------------------------------------------------------------------------------------------- ;;; ------------------------------------------------------------------------------------------------------------------- ;;; this function adds CENTS or FLOATS to text-attributes, in this way you can notate ;;; - have a look how it's written in the score -> all combinations of attributes possible ;;; ------------------------------------------------------------------------------------------------------------------- ;;; ------------------------------------------------------------------------------------------------------------------- (defun add-cents-tuning-to-text-atrributes (&key (centlist nil) (type nil)) (loop for i in (loop for x in (if (null centlist) (append (loop for i from 0 upto 99 collect i) (loop for i from 1 upto 99 collect (neg! i))) centlist) collect (compress (list x 'ct))) append (add-text-attributes (list i (write-to-string (if (equal type :float) (float (/ (append (compress (if (equal (car (explode i)) '-) (if (= (length (explode i)) 5) (filter-first 3 (explode i)) (filter-first 2 (explode i))) (if (= (length (explode i)) 4) (filter-first 2 (explode i)) (filter-first 1 (explode i))) ))) 100)) i)))))) ;;; EXAMPLES (add-cents-tuning-to-text-atrributes :type :float) ;; have a look to notation: cmd3 (-q -q e c4 fff q c4 mf 50ct e c4 mf -40ct e c5 ff) (add-cents-tuning-to-text-atrributes :type :cents) ;; cents are written ;; have a look to notation: cmd3 (-q -q e c4 fff q c4 mf 50ct e c4 mf -40ct e c5 ff) ;;; ------------------------------------------------------------------------------------------------------------------- ;;; ------------------------------------------------------------------------------------------------------------------- ;;; this function get out all notated microtones for TUNING ;;; if there is nothing written it will be 0 cents (0) ;;; you can combine all kinds of attributes ;;; ------------------------------------------------------------------------------------------------------------------- ;;; ------------------------------------------------------------------------------------------------------------------- (defun memberp (n liste) (not (equal 'nil (member n liste)))) (defun find-duplicates (lst) (cond ((null lst) '()) ((member (car lst) (cdr lst)) (cons (car lst) (find-duplicates (cdr lst)))) (t (find-duplicates (cdr lst))))) (defun get-tuning-from-omn* (omnlist centlist) (loop for i in (single-events (length-rest-remove omnlist)) with n = 0 when (not (null (find-duplicates (append (disjoin-attributes (car (last i))) centlist)))) do (setf n (float (/ (append (compress (remove-if-not #'numberp (explode (car (find-duplicates (append (disjoin-attributes (car (last i))) centlist))))))) 100))) and collect (if (equal (car (explode (car (find-duplicates (append (disjoin-attributes (car (last i))) centlist))))) '-) (* -1 n) n) else collect 0)) ;;; EXAMPLES (setf centlist (add-cents-tuning-to-text-atrributes :type :float)) ;;; evaluate this and you will get the tuning-list with all combinations of attributes (get-tuning-from-omn* '(-q -q e c4 fff q c4 mf legno+50ct+num1 e c4 mf -50ct+legno+batt e c5 ff pizz+-34ct) centlist) => (0 0.5 0.5 -0.34) (get-tuning-from-omn* '(-q -q e c4 fff -34ct+pizz q c4 mf legno+50ct e c4 mf -50ct+legno+batt e c5 ff pizz+-34ct) centlist) => (-0.34 0.5 -0.5 -0.34) (get-tuning-from-omn* '(-q -q e c4 fff -34ct+pizz+num11 q c4 mf legno+50ct e c4 mf -50ct+legno+batt e c5 ff pizz+-34ct) centlist) => (-0.34 0.5 -0.5 -0.34) ;;; cmd3 for LAYOUT/SCORE (-q -q e c4 fff -34ct+pizz+num11 q c4 mf legno+50ct e c4 mf -50ct+legno+batt e c5 ff pizz+-34ct) (-q -q e c4 fff q c4 mf legno+50ct+num1 e c4 mf -50ct+legno+batt+num2 e c5 ff pizz+legno+-34ct)  
    • By Wim Dijkgraaf
      In the following line of code, what is the difference between vector and float?
       
      (vector-to-velocity 0.1 0.9 (pitch-to-velocity 'pppp 'ffff '(c1 d1 e1 f1 g1 a1 b1 c2 d2 e2 f2) :type :float)) The function name is 'vector-to-velocity' but in pitch-to-velocity the type is set to :float (instead of :vector).
       
      Looks like they are synonyms.
       
      Thanks in advance,
       
      Wim Dijkgraaf
       
      added 2 minutes later I guess this is the answer:
       
      Vectors are one-dimensional arrays, therefore a subtype of array.
       
      Wim :-)
      added 7 minutes later Code above being equal to:
       
      (pitch-to-velocity 'pppp 'ffff '(c1 d1 e1 f1 g1 a1 b1 c2 d2 e2 f2)) Got it :-)
×
×
  • Create New...