Jump to content

Featured Replies

Posted

Dear All, 

 

Is there a function for get all intervals of a row (or any list of integers or pitches) in relation to one note ?

For example, given this 12 tone row:

(a3 gs4 c4 d4 bb3 b3 fs4 f4 cs4 g4 ds4 e4)

Get all intervals related to a4 ?

The result should be:

 

(-12 -1 -9 -7 -11 -10 -3 -4 -8 -2 -6 -5)

 

This is for getting a resultant set of numbers related to a chromatic octave-module. Each order of the set result in a different set.

Maybe can be a mapping function.

 


(defun interval-distance (alist n)
  (let ((alist (if (pitchp (car alist))
                 (pitch-to-midi alist)
                 alist))
        (n (if (pitchp n)
             (pitch-to-midi n)
             n)))

    (loop for i in alist
      collect (- i n))))
    
(interval-distance '(c4 d4 b2 e7) 'c4)
=> (0 2 -13 40)
(interval-distance '(c4 d4) 'c4)
=> (0 2)
(interval-distance '(43 44) '41)
=> (2 3)
(interval-distance '(56 48 11) 'c4)
=> (-4 -12 -49)

 

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