Jump to content

step-to-pitch


Recommended Posts

here is a little "sketched" function STEP-TO-PITCH , perhaps OM could further develop the function...

 

;;; FUNCTION

(defun step-to-pitch (&key steps pitches start)
  (let ((pos (car (position-item start pitches))))
    (append (list (nth pos pitches))
            (loop for i in steps
              ;; setting pos by add the step to pos
              do (setf pos (+ pos i))
              ;; when pitch-range to small then reset to lowest pitch+step
              ;; could be a more intelligent solution
              when (> pos (length pitches))
              do (setf pos (+ 0 i))
              collect (nth pos pitches)))))



;;; EXAMPLES

(step-to-pitch :steps '(1 1 -1 2 2 -1)
               :pitches '(c4 d4 e4 f4 g4 a4)
               :start 'c4)

;; => (c4 d4 e4 d4 f4 a4 g4)


(step-to-pitch :steps '(1 1 -1 2 2 -1)
               :pitches (expand-tonality '(c4 chromatic))
               :start 'c4)

;; => (c4 cs4 d4 cs4 ds4 f4 e4)


(step-to-pitch :steps '(1 1 -1 2 2 -1 5)
               :pitches (expand-tonality '(c4 messiaen-mode6))
               :start 'c4)

;; => (c4 d4 e4 d4 f4 gs4 fs4 gs4)


 

Link to comment
Share on other sites

This is how the new function TONALITY-STEP will work:

 

tonality-step (scale step &key start ambitus (sort t))

(tonality-step '(c4 d4 e4 g4 a4 f4) '(1 1 -1 2 2 -1))
=> (c4 d4 e4 d4 f4 a4 g4)

(tonality-step '(c4 d4 e4 g4 a4 f4) '(1 1 -1 2 2 -1 5 3 2 3 -2 -2 1 1))
=> (c4 d4 e4 d4 f4 a4 g4 f5 c6 e6 a6 f6 d6 e6 f6)

(tonality-step '(c4 chromatic) '(1 1 -1 2 2 -1))
 => (c4 cs4 d4 cs4 eb4 f4 e4)

(tonality-step '(c4 messiaen-mode6) '(1 1 -1 2 2 -1 5))
=> (c4 d4 e4 d4 f4 gs4 fs4 d5)

(tonality-step '(c4 messiaen-mode6) '(1 1 -1 2 2 -1 5 3 2 3 -2 -2 1 1))
=> (c4 d4 e4 d4 f4 gs4 fs4 d5 fs5 bb5 d6 b5 gs5 bb5 b5)

(tonality-step '(c4 messiaen-mode6) '(1 2 -1 2 2 -1 5 3 2 3 -2 -2 1 1) :ambitus 'scale)
=> (c4 d4 f4 e4 fs4 bb4 gs4 e4 gs4 b4 e4 c4 bb4 b4 c4)

(tonality-step '(c4 messiaen-mode6) '(1 2 -1 2 2 -1 5 3 2 3 -2 -2 1 1) :ambitus '(c3 a4))
=> (c4 d4 f4 e4 fs4 bb3 gs4 e4 gs4 b3 e4 c4 bb3 b3 c4)

(tonality-step '((c4d4e4g4a4f4) (c3 messiaen-mode6) (c4d4e4g4a4f4))
               '((1 1 -1 2 2 -1)
                 (5 3 2 3 -2 -2 1 1)
                 (2 -1 3 2 3 -2 -2 1 1)))
=> ((c4 d4 e4 d4 f4 a4 g4)
    (c3 gs3 c4 e4 gs4 f4 d4 e4 f4)
    (c4 e4 d4 g4 c5 f5 d5 a4 c5 d5))

 

Link to comment
Share on other sites

Just to let you know the TONALITY-MAP with :map 'shift is doing the same thing already :smile:

 

(tonality-step '(c4 messiaen-mode6) '(1 1 -1 (2 2 -1) 5 3 (2 3 -2) -2 1 1))
=> (c4 d4 e4 d4 f4gs4fs4 d5 fs5 bb5d6b5 gs5 bb5 b5)

(tonality-map '(messiaen-mode6 :map shift)
               (interval-to-pitch '(1 1 -1 (2 2 -1) 5 3 (2 3 -2) -2 1 1)))
=> (c4 d4 e4 d4 f4gs4fs4 d5 fs5 bb5d6b5 gs5 bb5 b5)

 

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

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy