Jump to content

Featured Replies

Posted

I have a basic lisp question - I'd like to create a function that takes a tonality as its argument and performs something like the following line: 

 

(setf test (tonality-map '((pcs '3-2) :root b3 :map shift) (make-scale 'c4 12)))

 

So (defun pitches (tonality) .....) - and then (pitches (pcs '3-2)) would return the list (b3 c4 d4 b4 c5 d5 b5 c6 d6 b6 c7 d7)

 

Thanks so much!

 

 

 

The return is what you are looking for:

(tonality-map '((pcs '3-2) :root b3 :map shift) (make-scale 'c4 12))
=> (b3 c4 d4 b4 c5 d5 b5 c6 d6 b6 c7 d7)

or I don't understand you question :smile:

  • Author

Sorry if I am not clear - yes the return is what I want. Now I'd like to have a new function that only accepts the collection and returns this same notes.  

 

So (newfunction (pcs '3-2)) gives the same result.

 

These are obviously wrong - 

(defun newfunction (tonality)
  (tonality-map '((tonality) :root b3 :map shift) (make-scale 'c4 12)))

 

(defun newfunction (tonality)
  (tonality-map '(tonality :root b3 :map shift) (make-scale 'c4 12)))

 

My goal is to create more complex functions that make use of tonality-map - I realize this might seem unneeded in this simple example - but as the code gets complex I think this function would be helpful for me. 

 

Many Thanks!!!

  • 1 year later...
  • Author

Hi Janusz,

 

Any idea why this stopped working? I've changed :map shift to :map step but it's still not working...

 

thanks!

Avner 

Works here:

(defun tmap (tonality)
  (tonality-map `(,tonality :root b3 :map step) (make-scale 'c4 12)))
  
(tmap (pcs '3-2))
=> (b3 c4 d4 b4 c5 d5 b5 c6 d6 b6 c7 d7)

 

added 3 minutes later

If you are getting an error you need to provide the expression otherwise I can't help.

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