• SONAR
  • How To Alternate Panning (Per Note)? (p.3)
2017/01/02 10:37:03
AdamGrossmanLG
Soundwise
There you go. Save this code as NotePan.CAL in your Sonar CAL scripts folder.
Then select a track you want to insert MIDI pan to, hit CTRL+F1, browse to your CAL scripts folder, choose NotePan.CAL. Enjoy!
 

 
;
;NotePan.CAL by Alisa Miller
;
;This CAL program will insert a determined pan event (CC 10) after each note event.
;

(do
  (int count 0)
  (int left 0)
  (int right 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)

    (forEachEvent
      (if (== Event.Kind NOTE)
        (do
          (if (== count 0)
            (insert (+ Event.Time 1) Event.Chan CONTROL 10 (= Control.Val left)
            )
          )
           (++ count)
           (insert (+ Event.Time 0) Event.Chan CONTROL 10 (= Control.Val right))
         (if (== count 2)
              (= count 0) ; if count is 2, reset to 0
         NIL
          )
        )
      )
    )
)
 





 
i notice with this one if you have some fast 16ths notes it doesnt have enough time to change the pan, the notes get all messed up
2017/01/02 10:41:15
AdamGrossmanLG
Strange that the pan knob doesnt move as this is happening too.
 
2017/01/02 13:07:42
brundlefly
SilverBlueMedallion
 
the modified CAL leads to this






Sorry about that; should have double-checked. The forum software is unavoidably adding spaces to the blank line returns between sections. I added semicolons to those lines in my original post to work around it. You can just delete the spaces from your copy.
2017/01/02 13:28:07
brundlefly
SilverBlueMedallion
Strange that the pan knob doesnt move as this is happening too.
 


MIDI track widgets are controls, not indicators. They send an initial message on the forced output channel (or channel 1 by default) when playback is started, and will send messages in real time if moved during playback (or by automation envelopes), but they don't 'read' messages embedded in the track. A single MIDI track could potentially contain controllers for any or all of the 16 midi channels moving independently in which case it wouldn't make sense for the widget to follow every controller in the track.
2017/01/02 16:08:20
tlw
Melda do a free version of their audio autopanner, it works very well indeed and can sync to a huge range of note values and with customisable wave-form and pan laws.
 
If what's needed is to pan hits that aren't quantised/dead in time so syncing and using fixed note values and a steady fixed tempo square/rectangular wave LFO won't work I'd do the panning the way Craig Anderson suggests.
 
https://www.meldaproduction.com
2017/01/04 13:06:05
Soundwise
SilverBlueMedallion
 
i notice with this one if you have some fast 16ths notes it doesnt have enough time to change the pan, the notes get all messed up


It is strange. Works flawlessly here.

2017/01/04 14:17:59
brundlefly
My guess is results will vary depending on what synth you're driving. Not allowing at least a few milliseconds between a CC message and the next Note On is always potentially problematic. And different synths will likely respond differently to pan messages received while a note is sounding, depending on the MIDI implementation.
2017/01/04 14:31:09
Soundwise
brundlefly
My guess is results will vary depending on what synth you're driving. Not allowing at least a few milliseconds between a CC message and the next Note On is always potentially problematic. And different synths will likely respond differently to pan messages received while a note is sounding, depending on the MIDI implementation.


I agree with you but I'm not an advanced CAL user and couldn't put together a working script that inserts a CC a few ticks ahead of the event. Maybe you can help me to find a clear description of CAL scripting language?
2017/01/04 14:45:44
brundlefly
My CAL skills are rusty, and were never far beyond rudimentary. This is the only language reference I know of:
 
    http://members.ziggo.nl/t...rogramming%20Guide.pdf
 
If you check my version of your CAL, you'll see it's subtracting 30 ticks from Event.Time in the insert statement:
 
(insert (- Event.Time 30) Event.Chan CONTROL 10 (= Control.Val position))
 
EDIT: Fixed the hyperlink
 
 
 
 
2017/01/04 15:02:23
Soundwise
That link doesn't work for me
Het opgevraagde bestand/pagina is niet bekend

brundlefly
If you check my version of your CAL, you'll see it's subtracting 30 ticks from Event.Time in the insert statement:
 
(insert (- Event.Time 30) Event.Chan CONTROL 10 (= Control.Val position))

For some reason this doesn't work, I get "CAL Error 014 Value out of range" pop-up.
 
© 2026 APG vNext Commercial Version 5.1

Use My Existing Forum Account

Use My Social Media Account