Jump to content

reverse to "expand-tonality"


Recommended Posts

There is a function "expand-tonality" that gives me the following result: (expand-tonality ' (c4 messiaen-mode4)) => (c4 cs4 d4 f4 fs4 g4 gs4 b4). Is there a reverse function? That is, the input would be the notes and the output would be the name of the scale/tonality?

 

Thanks in advance for your help!

Link to comment
Share on other sites

You can use pitch class analysis to know the Forte number of a set of pitches

like this

(pcs-analysis '(7 10 3 8 11 5 2))

 

Original Prime Order: (7 10 3 8 11 5 2)

 

Pitch: (g4 bb4 eb4 gs4 b4 f4 d4)

 

Inversion: (5 2 9 4 1 7 10)

 

Complement: (0 1 4 6 9)

 

Normal Order: (2 3 5 7 8 10 11)

 

Prime Form: (0 1 3 5 6 8 9)

 

Forte: 7-32b - THIS IS WHAT YOU NEED

 

Directed Interval Vector: (1 2 2 1 2 1 3)

 

Interval Vector: (3 3 5 4 4 2)

 

Interval Class: (3 5 5 3 6 3)

Link to comment
Share on other sites

Hi, here's a slow way to do it. 

 

Jesper

 

;; for faster result you could remove modes from this list

(setf mds '(Acoustic Chromatic Major Minor Ionian-I Dorian-II Phrygian-III Lydian-IV Mixolydian-V Aeolian-VI Locrian-VII Pentatonic Diminished-Augmented Dominant Altered Tones Hyperaeolian Mischung Genus Octatonic Composers Gypsy Byzantine Gregorian Messiaen Tcherepnin Prometheus Arabic Persian Iran Peruvian Hawaiian Blues Jazz Scottish Greece Armenia Ethiopia Algerian Tunisian Egyptian Korean Japan Jewish Hungarian Romanian Spanish North-America South-America China Indian Indian-Mela Indian-Raga))

 

(setf sc (flatten (loop for x in mds collect (library 'modes x nil :collect :all))))
;; raga-kuntalavarali throws an error so removing it
(setf sc (remove 'raga-kuntalavarali sc))

 

;; scale to look for
(setf scale '(c4 cs4 d4 f4 fs4 g4 gs4 b4))

 

(loop for x in sc when (equal scale (expand-tonality (list (car scale) x) :type :pitch)) collect x)

 

Might be better to use integers otherwise a different spelling will not match

 

(setf scale (pitch-to-integer '(c4 cs4 d4 f4 fs4 g4 gs4 b4)))


(loop for x in sc when (equal scale (expand-tonality (list 'c4 x) :type :integer)) collect x)
 

Faster to collect all the expanded scales once.

(setf all-scales (loop for x in sc collect (list x (expand-tonality (list 'c4 x) :type :integer))))

;; then use find to find the first one

(find scale all-scales :key 'cadr :test 'equal) 

 

;; or collect the positions of all matches

;; new scale with more matches

(setf scale (pitch-to-integer '(c4 d4 e4 f4 g4 gs4 bb4)))

(setf all-positions (loop with pos = -1 while pos collect (setf pos (position scale all-scales :key 'cadr :test 'equal :start (+ 1 pos))))) 

;; then get the matches

(setf result (loop for p in all-positions when p collect (nth p all-scales)))

 

((melodic-major (0 2 4 5 7 8 10)) (major-minor (0 2 4 5 7 8 10)) (mixolydian-b6 (0 2 4 5 7 8 10)) (aeolian-major (0 2 4 5 7 8 10)) (mischung6 (0 2 4 5 7 8 10)) (mela-carukesi (0 2 4 5 7 8 10)) (raga-charukeshi (0 2 4 5 7 8 10)) (raga-tarangini (0 2 4 5 7 8 10)))


 

 

Link to comment
Share on other sites

Thank you very much, JulioHerrlein. A good way to know the Forte number of a set of pitches. Best, Mauricio.

Many thanks for your kind reply, jesele. Your code works perfect. I am amazed by your absolute mastery of Lisp. Very best, Mauricio.

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