Jump to content

single-pitch-transpose


Recommended Posts

;;; i coded this little function because i wanted to transpose a single pitch without having
;;; a list as output: in the library (pitch-transpose -12 '(c4)) -> (c3)
;;; (or is there such a function/format already in the library?)


(defun single-pitch-transpose (pitch interval &key (midi-output 'nil))
  (if (numberp pitch)
    (if (equal midi-output 'nil)
      (midi-to-pitch (+ interval pitch))
      (+ interval pitch))
    (if (equal midi-output 'nil)
      (midi-to-pitch (+ interval (pitch-to-midi pitch)))
      (+ interval (pitch-to-midi pitch)))))



;;example1 -> omn-in omn-out
(single-pitch-transpose 'c4 -12)

;;example2 -> omn-in midi-out
(single-pitch-transpose 'c4 -12 :midi-output t)

;;example3 -> midi-in omn-out
(single-pitch-transpose 60 -12)

;;example4 -> midi-in midi-out
(single-pitch-transpose 60 -12 :midi-output t)
       

regards,

AM

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