Jump to content
  • 0
DocBob

Anyone know how to invert a melody?

Question

I want to invert a melody.  The built-in function "Process/Retrograde" reverses a clip - plays it end to beginning. 

What I want to do is invert the intervals. So C-> E becomes C->G#

 A major third up becomes a major third down,

Is there a CAL script to do it?  Any other method other than grunt work?

  • Like 1

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
16 hours ago, DocBob said:

I want to invert a melody.  The built-in function "Process/Retrograde" reverses a clip - plays it end to beginning. 

What I want to do is invert the intervals. So C-> E becomes C->G#

 A major third up becomes a major third down,

Is there a CAL script to do it?  Any other method other than grunt work?

Definitely a job a a well crafted CAL script....  I have not seen one that exists that does this.

Perhaps some enterprising person can write it.

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

Well...  did a bit of research and there is a CAL  "Invert_Retrograde.CAL"  In spite of its name it does NOT do retrograde,  just inverts.  I haven't looked at it detail but I did test it and it works, though I'm not sure how it chooses it's starting point relative to the key signature.  Good enough though. So now you can do retrograde as a built in function of Cakewalk and invert using the CAL and do both to produce a retrograde inversion.

Why do all of this??   These are tricks for developing a motive or phrase used by many classical composers.

Edited by DocBob

Share this post


Link to post
Share on other sites
  • 0

I couldn't find the link I got it from so here it is in text form....    Copy and paste into Notepad or other text editor,  save as "Invert.cal" and put it into the C:\Cakewalk Content\Cakewalk Core\CAL Scripts folder.

;  by MiRo

;  This program will reverse the intervals in the selection.


(do
   (int Event 0)    ; Event counter for status line
   (int Hi 0)     ; Storage for highest note's pitch
   (int Lo 128)   ; Storage for lowest  note's pitch
)


(if (!= Event.Kind NOTE)
  NIL
  (do
    (message "Processing Note Event no. " (++ Event))
    (switch Note.Key
   
    Note.Key
     (do   
       (if (< Hi Note.Key)
         (do
           (= Hi Note.Key) ; new High Key 1
         )
       NIL
       )
 
       (if (> Lo Note.Key)
         (do
           (= Lo Note.Key) ; new Low Key 1
         )
       NIL
       )
    )
 )

 )
)


(forEachEvent
  (if (== Event.Kind NOTE)
    (= Note.Key (+ (+ (* 2 (- (+ Lo (/ (- Hi Lo) 2)) Note.Key)) (% (- Hi Lo) 2)) Note.Key))
  )
)

 

  • Thanks 1

Share this post


Link to post
Share on other sites
  • 0

It uses the key of the piece as a reference, so make sure you set that before running the CAL script.

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...