Jump to content

Modifying a CAL script


Mick Hamer

Recommended Posts

I’m trying to analyse two polyphonic midi sequences as part of a project to analyse the accuracy of wave to midi software. Many of the notes in one sequence are duplicated in the second sequence, with onsets a few ticks apart. Some notes aren’t duplicated.
If I put the two sequences on different tracks RemoveDupNotes.cal does a good job at removing duplicates, but the output is random; sometimes it’s a duplicate from track 1 that remains, sometimes track 2. What I’d like to do is to identify which notes in track 1 are duplicated in track 2 and then remove the duplicates from just one track.
Does anyone have any suggestions how to modify this script to achieve this?  

RemoveDupNotes.cal

Link to comment
Share on other sites

Create a Cal script which assigns a specific channel to note events into each track

 (forEachEvent
 (do
    (if (== Event.Kind NOTE))
     (= Event.Chan 0)) ;  any chosen channel
  ))

you know then which note belongs to which track and can use into RemoveDupNotes.Cal, something like

(if (== Channel Event.Chan))  ;

Link to comment
Share on other sites

Thanks to both Glenn and Serge for your input. Locking the track just means that that the script doesn't detect any duplicates. But your suggestion, Glenn, did force me to use the 2021 Cakewalk by Bandlab (I normally run CAL scripts in my aged Cakewalk Pro 9.0) and I found by accident that the script  removes duplicates from track 1, and only track 1 in the 2021 edition, which essentially solves my problem. Why the script should behave so differently in the two editions, I don't know

Link to comment
Share on other sites

maybe something got fixed so which ever track is selected first is the "primary one"? there are a number of software products that behave like that, and its possible someone called out the arbitrary nature of running a CAL on two or more tracks and the Bakers decided to force the first selected as primary.

for myself, i simply merge two (or more) tracks into a new single midi and then run my CAL (or MIDI plugin) on that.

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...