• SONAR
  • How To Alternate Panning (Per Note)? (p.4)
2017/01/04 15:19:40
Soundwise
OK, her is working brundlefly's script
 

 
;NotePan.CAL by David Baay, modified significantly from the original by Alisa Miller
;
; This CAL script will insert alternating Pan (CC10) events 30 ticks before each note event at 1:01:030 or later.
; If any notes occur before 1:01:030, the Track Pan should be set to the value equal to the left pan setting that you
; intend to set using the CAL to set the initial pan position before playback starts.
;
(do
 (int count 0)
 (int left 0)
 (int right 127)
 (int position 127)
;
;Get Min and Max Pan values to determine Pan changes
 (getInt left "Enter the left pan amount" 0 64)
 (getInt right "Enter the right pan amount" 64 127)
 (= position right)
   (forEachEvent
     (if (&& (>= Event.Time 3) (== Event.Kind NOTE))
       (do
         (insert (- Event.Time 3) Event.Chan CONTROL 10 (= Control.Val position))
         (if (<= position 64)
           (= position right)
           (= position left); else
         );end if
       );end do
     ); end if
  );end for
);end do
 

2017/01/04 16:10:44
brundlefly
Fixed the hyperlink in the original post. Here it is again:
 
     http://members.ziggo.nl/t...rogramming%20Guide.pdf
2017/01/04 19:30:44
Soundwise
Thanks, brundlefly!
Here is an updated version with predelay and time selection options:
 
 
;
;NotePan.CAL by Alisa Miller
;Thanks to David Baay (brundlefly) for useful ideas
;
;This CAL program will insert a user-defined alternating panning (CC 10) for each note event within a selected region or a clip at user-defined time from 0 to 240 ticks (1/16 of the project tempo) before the note.
; IMPORTANT! Some notes at the beginning of the project may need manual adjustment.

(do
  (int count 0)
  (int left 64)
  (int right 64)
  (int time 3)
  (= Now From)
  
;; Get Min and Max Pan values to determine Pan changes
 (getInt left "Enter the left pan amount?" 0 127)
 (getInt right "Enter the right pan amount?" 0 127)
 (getInt time "Enter the predelay time in ticks" 0 240)
    (forEachEvent
      (if (< Now Thru)
      (if (&& (== Event.Kind NOTE) (>= Event.Time time))
        (do
            (if (== count 0)
                (insert (- Event.Time (- time 1)) Event.Chan CONTROL 10 (= Control.Val left))
             )
                (++ count)
                (insert (- Event.Time time) Event.Chan CONTROL 10 (= Control.Val right))
            (if (== count 2)
                    (= count 0) ; if count is 2, reset to 0
            )
        )
      )
      )
    )
)

2017/01/04 23:18:44
AdamGrossmanLG
nice update.  for anyone using a PPQN other than 960, you will need to modify the file accordingly for the ticks.
2017/01/05 01:59:20
brundlefly
No, a tick is a tick. The amount of absolute time represented by a tick will vary with PPQ and tempo, but if you specify 10 ticks early, it will be 10 ticks at any PPQ.
 
There isn't much point in operating at other PPQs in any case, as SONAR records and stores everything at 960 internally, and tick values in snap and quantize dialogs are referenced to 960PPQ regardless of the clock setting.
2017/01/05 02:56:17
Boydie
SilverBlueMedallion
coming back to this:

how do I do this if it is already in audio format?


I still think drawing in the pan automation is the best way to go

There is a strong chance that there will be a repeating pattern so you will only have to draw the automation for one "loop" (or for each variation)

Once you have drawn it in the PAN automation lane you can copy and paste the automation

You can either go for "hard pans" by setting each note left of right - or you could draw in diagonal lines/curves so the beats "drift" left and right (or a mixture of the 2)
2017/01/05 07:46:46
Soundwise
SilverBlueMedallion
nice update.  for anyone using a PPQN other than 960, you will need to modify the file accordingly for the ticks.


That's the beauty of CAL - you can modify or create any script the way you need.
2017/01/05 12:52:42
rogeriodec
Soundwise
 
That's the beauty of CAL - you can modify or create any script the way you need.


Hello!
Would you find it easy to create a CAL script for this topic (How to select just the top or bottom MIDI notes)?
The idea would be an interface that would ask which note (known as "voice" in Sibelius) to keep selected: top note, bottom note, or first note, 2nd note, and so on.
For the CAL Script to work, it needs all the events to be pre-selected, so the idea is to do the reverse, deselect the unwanted notes and leave only the desired notes selected.
I'm even trying to venture to learn CAL Script, but I did not find anything that could deselect notes.
Could you help?
 
2017/01/05 13:18:09
brundlefly
I could be wrong, but don't think CAL has the capability to leave a specific subset of a clip selected on exit. But it could do what 'Split Notes' does, and automatically cut-paste the specified subset to another track. I've thought about giving it a whirl, myself, after reading that thread.
2017/01/05 13:34:34
scook
Yes, AFAIK, there is no function to manipulate the selection criteria. It would require setting up a new track to act as the buffer for the new selection.
 
For those interested in rolling their own CAL scripts, in addition to the pdf mentioned above, I find the "CAL Reference.chm" bundled with the CAL Editor handy. I do not recall if the editor is useful. I use a different editor.
 
© 2026 APG vNext Commercial Version 5.1

Use My Existing Forum Account

Use My Social Media Account