AM Posted October 19, 2018 Share Posted October 19, 2018 (edited) 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) Edited October 20, 2018 by AM a small change - now you can write also 0ct for no detuning opmo 1 Quote Link to comment Share on other sites More sharing options...
AM Posted October 20, 2018 Author Share Posted October 20, 2018 EXAMPLE, very easy to use... ;;; EXAMPLE HOW TO USE <get-tuning-from-omn*> (setf centlist (add-cents-tuning-to-text-atrributes :type :float)) ;;; generating a omn-seq with mictronoes (by using articulation-SLOT (setf omn-seq (make-omn :length (quantize (gen-white-noise 50) '(2 3 5) :scale 1.4 :tolerance 0.02) :pitch (filter-repeat 1 (vector-to-pitch '(c2 b6) (gen-white-noise 50))) :span :pitch :velocity (vector-to-velocity 0.1 0.99 (gen-white-noise 50)) :articulation (rnd-repeat 50 '(0ct 7ct -5ct 16ct -31ct -14ct 50ct -50ct)))) ;;; generating SCORE/MIDI (def-score microtonal (:title "microtonal" :key-signature 'atonal :time-signature '(4 4) :tempo 120) (instr :omn omn-seq :channel 1 :tuning (get-tuning-from-omn* omn-seq centlist) :sound 'gm :program 'acoustic-grand-piano)) opmo 1 Quote Link to comment Share on other sites More sharing options...
AM Posted October 20, 2018 Author Share Posted October 20, 2018 (edited) another EXAMPLE, with mapped pitches/cents ;;; ----------------------------------------------------------------------------------------- ;;; MAPPED CENTS/PITCHES ;;; ----------------------------------------------------------------------------------------- ;(setf pitches (rnd-repeat 100 '(d1 c2 g3 c4 d4 e4 f4 g4 gs4 bb4 c5 d5 e5 f5 g5 gs5 bb5))) (setf pitches (rnd-repeat 100 '(e4 f4 g4 gs4 bb4 c5 d5 e5 f5 g5 gs5 bb5))) (setf centlist (replace-map '(((bb4 bb5) -31ct) ((c4 c5 c2) 0ct) ((d1 d4 d5) 2ct) ((e4 e5) -14ct) ((f4 f5) 50ct) ((g3 g4 g5) 5ct) ((gs4 gs5) 41ct)) pitches :otherwise '0ct)) (setf omn-seq (make-omn :length (quantize (gen-white-noise 50) '(2 3 5) :scale 0.8 :tolerance 0.02) :pitch (filter-repeat 1 pitches) :span :pitch :velocity (vector-to-velocity 0.1 0.99 (gen-white-noise 50)) :articulation centlist)) ;;; generating SCORE/MIDI (def-score microtonal (:title "microtonal" :key-signature 'atonal :time-signature '(4 4) :tempo 160) (instr :omn omn-seq :channel 1 :tuning (get-tuning-from-omn* omn-seq centlist) :sound 'gm :program 'acoustic-grand-piano)) Edited October 20, 2018 by AM BUG in replace-map => should be :otherwise '0ct opmo 1 Quote Link to comment Share on other sites More sharing options...
opmo Posted October 20, 2018 Share Posted October 20, 2018 The future pitch (v1.4) will look like: c4 c4[50] fs4[50] d6[-30] etc... chord c4fs5[50] Every cents value which falls into microtonal notation (50, 30 -50 -75 ...) will be part of the notation all others will be written above the note: -43c Yuichi Yamamoto, lviklund, torstenanders and 1 other 4 Quote Link to comment Share on other sites More sharing options...
AM Posted October 20, 2018 Author Share Posted October 20, 2018 great! will be the best solution! Quote Link to comment Share on other sites More sharing options...
Yuichi Yamamoto Posted October 20, 2018 Share Posted October 20, 2018 Awesome! Thank you for sharing! Quote Link to comment Share on other sites More sharing options...
opmo Posted October 20, 2018 Share Posted October 20, 2018 On 10/20/2018 at 12:02 PM, AM said: (setf omn-seq (make-omn :length (quantize (gen-white-noise 50) '(2 3 5) :scale 0.8 :tolerance 0.02) :pitch (filter-repeat 1 pitches) :span :pitch :velocity (vector-to-velocity 0.1 0.99 (gen-white-noise 50)) :articulation centlist)) You should't use :span :pitch with tupets otherwise the time signature will be not much of a use. Quote Link to comment Share on other sites More sharing options...
HenryT Posted August 12 Share Posted August 12 Hi, On MAPPED CENTS/PITCHES example evaluation stops at get-tuning-from-omn* and OMN parse error is reported. Any suggestions how this could be repaired? Thanks for your help, Henry Quote Link to comment Share on other sites More sharing options...
HenryT Posted August 13 Share Posted August 13 Uusi attribute-tuning.opmo works, Uusi mapped cents and pitches.opmo does not work. Uusi attribute-tuning.opmo Uusi mapped cents and pitches.opmo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.