Skip to content
View in the app

A better way to browse. Learn more.

Learn more

Interval distance of a list (integers or pitches) in relation to a chosen note

Featured Replies

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)

 

simple brain gym 😄 

really not 🤣

Create an account or sign in to comment

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.