AM Posted September 22, 2018 Posted September 22, 2018 is there an RESPELL-function which would change sharps into flats and flats into sharps for single pitch-values? enharmonic changes.... like: (enharmonic 'cs4) => db4 (enharmonic 'db4) => cs4 but there is an other solution for an EQUALP* whicht is "independent" from pitch-name (enharmonic)... but a function like ENHARMONIC or EQUALP* could be useful (for pattern-match etc)... (defun equalp* (a b) (equal (pitch-to-midi a) (pitch-to-midi b))) (equalp* 'cs4 'db4) => t there is an EQUALP in the system (but not documented), and works like that (equalp 'cs4 'db4) => nil (equalp 'cs4 'cs4) => t : Quote
torstenanders Posted October 13, 2018 Posted October 13, 2018 EQUALP is part of the Common Lisp standard. You can find its documentation at http://www.lispworks.com/documentation/HyperSpec/Body/f_equalp.htm Note that Common Lisp has a whole zoo of equality comparison functions, see eq, eql, equal, =, string=, string-equal, char=, char-equal in that documentation. Best, Torsten Quote
AM Posted October 13, 2018 Author Posted October 13, 2018 thank you, torsten! by now I have noticed that too (equalp in LISP) Quote
AM Posted October 13, 2018 Author Posted October 13, 2018 RESPELL/ENHARMONIC here is a solution for that (i hope i got all cases) - could be usefull in OPMO - it was/is a explode/compress-thing of the pitch-symbols and to think about all cases. please check it!! greetings andré (defun enharmonic* (pitches) (let ((liste '((cs db) (ds eb) (e fb) (es f) (fs gb) (gs ab) (as bb) (b cb) (bs c)))) (loop for n in pitches collect (let ((octave (car (last (explode n)))) (pitchname (compress (butlast (explode n))))) (append (compress (list (car (set-difference (loop for i in liste ;; cases with octave-change when (or (and (equal i '(bs c)) (equal pitchname 'bs)) (and (equal i '(b cb)) (equal pitchname 'b))) do (setf octave (1+ octave)) when (or (and (equal i '(bs c)) (equal pitchname 'c)) (and (equal i '(b cb)) (equal pitchname 'cb))) do (setf octave (1- octave)) ;; ordinary cases when (member pitchname i) append i) (list pitchname))) octave))))))) (enharmonic* '(fb4 fb4 cb5)) => (e4 e4 b4) (enharmonic* '(f4 b7)) => (es4 cb8) (enharmonic* '(bs4 cs5 cb5)) => (c5 db5 b4) (enharmonic* '(c6 gs7 gb4)) => (bs5 ab7 fs4) Quote
JulioHerrlein Posted October 18, 2018 Posted October 18, 2018 Maybe a Kind of Substitute map function could be useful something like I did it to interval substitution, to transform interval ( 0 - 11) to interval classes (0 - 6) (replace-map '((-11 1) (-10 2) (-9 3) (-8 4) (-7 5) (7 -5) (8 -4) (9 -3)(10 -2)(11 -1)) '(1 2 3 4 5 6 7 8 9 10 11 12 13)) Maybe a kind of mapping to tonalities could be useful. Respell to tonality function or respell-to-collection '( pitch list) Quote
JulioHerrlein Posted October 18, 2018 Posted October 18, 2018 1 hour ago, AM said: code it, julio!! I´m good in having ideas, but as coder... I´ll try in the summer vacancy ! Best, Julio I can try to code within the existent functions in OM Quote
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.