Jump to content

Featured Replies

Posted

Hi,

I want to make the following construction:

(defun mapping-integers (x y)
  (interval-to-pitch (integer-to-interval x) :start y))

(mapping-integers '(0 4 5 9 11) 'c5)


I get an error-warning having the wrong start parameter, how could this be done?

I have a list of integers (0 4 5 9 11) and a list of root notes (c5) and want them to process to get lists like (c5 e5 f5 a5 b5)..

ole

  • Author

to answer my own question, I found a workaround:

(defun mapping-integers-2 (x y)
  (chordize (pitch-transpose (pitch-to-integer y) (integer-to-pitch x))))

(mapping-integers-2 '(0 4 5 9 11) 'g4)


nevertheless I would like to know if it is possible to handle the keyword parameters with variables..

Solution:

(pitch-transpose-start 'c5 (integer-to-pitch '(0 4 5 9 11)))
=> (c5 e5 f5 a5 b5)


with &key

(defun mapping-integers (l &key start)
  (if start (pitch-transpose-start start (integer-to-pitch l))
    (integer-to-pitch l)))

(mapping-integers '(0 4 5 9 11) :start 'c5)
=> (c5 e5 f5 a5 b5)
 
with &optional
(defun mapping-integers2 (l &optional start)
  (if start (pitch-transpose-start start (integer-to-pitch l))
    (integer-to-pitch l)))

(mapping-integers2 '(0 4 5 9 11) 'c5)
=> (c5 e5 f5 a5 b5)

Create an account or sign in to comment


Copyright © 2014-2025 Opusmodus™ Ltd. All rights reserved.
Product features, specifications, system requirements and availability are subject to change without notice.
Opusmodus, the Opusmodus logo, and other Opusmodus trademarks are either registered trademarks or trademarks of Opusmodus Ltd.
All other trademarks contained herein are the property of their respective owners.

Powered by Invision Community

Important Information

Terms of Use Privacy Policy