Jump to content

CAL - Select every othe midi note no matter the pitch?


sadicus

Recommended Posts

I've got no great way to do this, but this is the best I've found...

Select all in the event viewer (showing only notes)...

CTRL+CLICK every other one.

You can then shift to Piano Roll View and have every other note selected.

Edited by Gswitz
Link to comment
Share on other sites

If they fall consistently on or near the the same beat(s ) in every measure, you may be able to do it using Select by Filter with the appropriate beat and tick windows defined, but you might need to do it in two or more passes. I presume you want to move or process them somehow...? 

CAL could very likely do the processing for you, but I don't think has the capability to make a multi-event  selection for you and then exit to let you do something with that selection. It just processes an existing selection, working through the array one event at a time.

Link to comment
Share on other sites

3 hours ago, sadicus said:

What are some ways to Select every other midi note no matter the pitch, or duration? Just whatever note is next.
perhaps a CAL script could do this?

I have hundreds of CAL files in my collection, not single one mentioning selecting notes in such fashion (every other notes). But it is possible to create one to do the job.

I think Gswitz suggestion is the easiest way.

Link to comment
Share on other sites

oThanks all,
@James ArgI know 0 about CAL except how to use it. Also I might have some of the same scripts you do but if your willing to share please post a link!
@Gswitz, this method is why i'm seeking a cal script. The notes are not consistent and I just need a way for it to read left to right and select every other note no matter the pitch or length.

CAL challenge for anyone interested!

Link to comment
Share on other sites

13 hours ago, sadicus said:


@James ArgI know 0 about CAL except how to use it. Also I might have some of the same scripts you do but if your willing to share please post a link!
@Gswitz, this method is why i'm seeking a cal script. The notes are not consistent and I just need a way for it to read left to right and select every other note no matter the pitch or length.

CAL challenge for anyone interested!

 

On 9/19/2019 at 8:45 AM, James Argo said:

But it is possible to create one to do the job.

I took sometime to read the CAL help files from the archive,  then I just realize, I think I was wrong when I say it is possible. I even tried to create a script and test it, it does not work. In my understanding, CAL does not have any "select" function unless you specify the (limited pre-programmed) action after you select some events. For example, CAL may work to select certain events and copy the selected event to new track automatically, but may not work to select and show you the selected events. The problem with CAL is not stop there. Most CAL function does not work in x64 environment. Most CAL script I tried works in Win XP + Sonar 8.5, failed to run in Win7 x64 + CbB. So, sorry I can't help that much, at least I tried.

  • Like 1
Link to comment
Share on other sites

The nearest you could get with CAL would be to copy the events to another track, then delete/update every other note.

But in saying that, whatever you're wanting to do AFTER the select might be possible in CAL.

So rather than trying to get CAL to select every other note (which it can't), what you can do is skip every other note an actually perform the operation you were going to do after you'd selected them.

  • Like 1
Link to comment
Share on other sites

This is a CAL script that I wrote that should do the task. 

After selecting all the notes, run the script.  It asks the nth number of notes to select - in your case , you enter 2

Every nth note will remain selected.

(do
    (int note_number 1)
    (int even 0)
    (int nth 2)
    (getInt nth "Please enter nth note" 2 50)
    (forEachEvent
        (if (== Event.Kind NOTE)
            (do

                (= even (% note_number nth))
                (if (== even 1)
                    (do
                    );exit do
                    (do
                        (delete)
                        (insert Event.Time Event.Chan NOTE Note.Key Note.Vel Note.Dur)
                    )
                );exit if
                (++ note_number)    
            );exit do
        );exit if
    );exit for
);exit do

Edited by Promidi
Additional information
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...
On 9/20/2019 at 7:13 AM, Promidi said:

This is a CAL script that I wrote that should do the task. 

After selecting all the notes, run the script.  It asks the nth number of notes to select - in your case , you enter 2

Every nth note will remain selected.

(do
    (int note_number 1)
    (int even 0)
    (int nth 2)
    (getInt nth "Please enter nth note" 2 50)
    (forEachEvent
        (if (== Event.Kind NOTE)
            (do

                (= even (% note_number nth))
                (if (== even 1)
                    (do
                    );exit do
                    (do
                        (delete)
                        (insert Event.Time Event.Chan NOTE Note.Key Note.Vel Note.Dur)
                    )
                );exit if
                (++ note_number)    
            );exit do
        );exit if
    );exit for
);exit do

Thanks Promidi!   I used your CAL on a long HHat sequece to reduce velocity on every other note. What a time saver. Great work!

Edited by mark dooley
Link to comment
Share on other sites

On 9/20/2019 at 9:13 PM, Promidi said:

This is a CAL script that I wrote that should do the task. 

After selecting all the notes, run the script.  It asks the nth number of notes to select - in your case , you enter 2

Every nth note will remain selected.

(do
    (int note_number 1)
    (int even 0)
    (int nth 2)
    (getInt nth "Please enter nth note" 2 50)
    (forEachEvent
        (if (== Event.Kind NOTE)
            (do

                (= even (% note_number nth))
                (if (== even 1)
                    (do
                    );exit do
                    (do
                        (delete)
                        (insert Event.Time Event.Chan NOTE Note.Key Note.Vel Note.Dur)
                    )
                );exit if
                (++ note_number)    
            );exit do
        );exit if
    );exit for
);exit do

I’ve named it “Select every nth note.cal” and added it into my archive which I believe includes ALL known CAL scripts and teaching resources for CAL. 
 

As I understand it not all CAL ”hooks” work any longer as it has been deprecated and only “guaranteed” to work  with the scripts that are still included with each release. Perhaps someone from Cakewalk who actually knows, could  confirm or update my understanding. I’ll add that info into my archive to accurately update it. 

  • Like 1
Link to comment
Share on other sites

2 minutes ago, Michael Vogel said:

As I understand it not all CAL ”hooks” work any longer as it has been deprecated and only “guaranteed” to work  with the scripts that are still included with each release. Perhaps someone from Cakewalk who actually knows, could  confirm or update my understanding. I’ll add that info into my archive to accurately update it. 

One command that I know will categorically crash Cakewalk by Bandlab is the Editslide and Editslide40 command.

Therefore if you wish to move the temporal position of a MIDI event, you have to directly edit the Event.Time parameter instead of the above commands.

There are some behavioural differences in some commands as well.  For instance, in CbB,  An EditPaste or EditPaste40 command, without arguments, will perform the paste unconditionally, without a dialogue box.   In earlier versions,   An EditPaste or EditPaste40 command without arguments will bring up a dialogue box. 

Adding parameters to these particular (paste cut copy) commands in CbB can result in a crash.

Also, any CAL scripts that use time parameters will only work correctly is your Preferences | Project | Clock > Ticks per quarter note is set to 960.  Any other value will result in CAL commands that have time arguments not being executed correctly.  For instance, the Insert command won't place the event at the specified time.

You just have to be aware of these idiosyncrasies when writing CAL scripts for CbB.

  • Like 1
Link to comment
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...