Jump to content

Interpolation between integers with gen-transition


Recommended Posts

Hello,

 

I'm hitting a brick wall with m thinking from object-oriented approaches. Basically, I want to create a melody line that "flutters"  pitches in a key corresponding to a bass pitch, and only when that bass pitch occurs. It's easy enough for an "If, then" statement but my attempt to solve this are leading me to take a first step of interpolating between bass pitches (as integers) and manually calculating the remains of the bar manually.
However this is not ideal as I would prefer to use euclidean-rhythm with a rotation, so finding a parametric approach this would be ideal. Here's the general approach I've begun. 

Any advice from people more experienced with LISP is appreciated.

 

(setf bass '((g2)(c3)(a2)(e3)(fs3)))
(setf bassint (pitch-to-integer bass))
=> ((-17) (-12) (-15) (-8) (-6))

;;; create a set of integers from interpolation 
;;; between bass integers (bassint), 
;;; then convert those to pitches

(setf melody (gen-transition 1 10 10 1))

Thanks,


Tom

Link to comment
Share on other sites

May be this can help a bit, I've tried this:

 

(setf bass '(g2 c3 a2 e3 fs3))
(setf bassint (pitch-to-integer bass))
;=> (-17 -12 -15 -8 -6)

;;; create a set of integers from interpolation 
;;; between bass integers (bassint), 
;;; then convert those to pitches

(defun linear-interpolation (numbers steps)
  (let ((interpolated-numbers nil))
    (loop for i from 0 below (- (length numbers) 1)
          for number = (nth i numbers)
          for next-number = (nth (1+ i) numbers)
          do (loop for j from 0 to steps
                   do  (push (+ (* (- next-number number)
                                   (/ (float j) steps))
                                number)
                             interpolated-numbers)
                   )
             (push next-number interpolated-numbers))
    (filter-repeat 1 (nreverse interpolated-numbers))))


(setf n-steps 4)
(setf new-ints (mapcar 'round (linear-interpolation bassint n-steps)))


(setf melody (integer-to-pitch new-ints))

(setf sop (filter-tie
           (make-omn
            :pitch (pitch-transpose 24 melody)
            :length '(e)
            :span :pitch
            )))

(setf bas (make-omn
           :pitch bass
           :length '(h)
           :span :pitch
           ))

(ps 'gm :fl (list sop) :bn (list bas) :time-signature '(4 4))

SB.

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